#include <bits/stdc++.h>
using namespace std;
int maxi;
string s, t;
map<string, int> a;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> s;
for(int i = 0; i < s.size(); i++){
t = s[i];
a[t]++;
for(int j = i + 1; j < s.size(); j++){
t = s[i];
t += s[j];
a[t]++;
}
}
map<string, int>::iterator it;
for (it = a.begin(); it != a.end(); it++)
{
maxi = max(maxi, it->second);
}
cout << maxi;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CmludCBtYXhpOwpzdHJpbmcgcywgdDsKbWFwPHN0cmluZywgaW50PiBhOwppbnQgbWFpbigpIHsKCWlvczo6c3luY193aXRoX3N0ZGlvKGZhbHNlKTsKCWNpbi50aWUoMCk7Cgljb3V0LnRpZSgwKTsKCWNpbiA+PiBzOwoJZm9yKGludCBpID0gMDsgaSA8IHMuc2l6ZSgpOyBpKyspewoJCXQgPSBzW2ldOwoJCWFbdF0rKzsKCQlmb3IoaW50IGogPSBpICsgMTsgaiA8IHMuc2l6ZSgpOyBqKyspewoJCQl0ID0gc1tpXTsKCQkJdCArPSBzW2pdOwoJCQlhW3RdKys7CgkJfQoJfQoJbWFwPHN0cmluZywgaW50Pjo6aXRlcmF0b3IgaXQ7Cglmb3IgKGl0ID0gYS5iZWdpbigpOyBpdCAhPSBhLmVuZCgpOyBpdCsrKQoJewoJCW1heGkgPSBtYXgobWF4aSwgaXQtPnNlY29uZCk7Cgl9Cgljb3V0IDw8IG1heGk7Cn0=