#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
string s;
cin >> s;
int f[256] = {0};
int x = 0, m = 0;
for (char c : s) {
if (++f[c] == 1) m++;
x = max(x, f[c]);
}
int a = s.length();
for (int k = 1; k <= x; k++) {
int t = 0;
for (int i = 0; i < 256; i++) if (f[i]) t += (f[i] + k - 1) / k;
int L = max(t, m);
if (L < a) a = L;
if (a <= m) break;
}
cout << a << endl;
}

京公网安备 11010502036488号