#include <bits/stdc++.h>
using namespace std;
const int inf = 0x20202020;
const long long mod = 1000000007;
const double eps = 1e-9;
const double pi = 3.1415926535897932384626;
const int DX[] = {1, 0, -1, 0}, DY[] = {0, 1, 0, -1};
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= mod;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
long long powmod(long long a, long long b, long long mod) {
  long long res = 1;
  a %= mod;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
int dp[1010][2], n, ans;
char s[1010];
vector<int> p[30];
int main() {
  scanf("%s", s);
  n = strlen(s);
  for (int i = 0; i < (int)n; i++) p[s[i] - 'A'].push_back(i % 2);
  for (int i = 0; i < (int)26; i++) {
    memset(dp, 0, sizeof(dp));
    for (int j = 0; j < (int)((int)(p[i]).size()); j++) {
      int v = p[i][j];
      dp[j + 1][v] = max(1 + dp[j][1 - v], dp[j][v]);
      dp[j + 1][1 - v] = dp[j][1 - v];
      ans = max(ans, max(dp[j + 1][0], dp[j + 1][1]));
    }
  }
  printf("%d\n", ans);
}
