#include <bits/stdc++.h>
using namespace std;
const long long N = 3e5 + 5, inf = 1e9 + 5;
string s;
int ans;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> s;
  for (int i = 0; i < 26; i++) {
    int t = 0;
    for (int j = 0; j < s.size();) {
      if (s[j] == 'A' + i) {
        t++;
        j++;
      } else {
        j += 2;
      }
    }
    ans = max(ans, t);
    t = 0;
    for (int j = 1; j < s.size();) {
      if (s[j] == 'A' + i) {
        t++;
        j++;
      } else {
        j += 2;
      }
    }
    ans = max(ans, t);
  }
  cout << ans;
  return 0;
}
