#include <bits/stdc++.h>
int ri() {
  int n;
  scanf("%d", &n);
  return n;
}
int64_t rll() {
  long long n;
  scanf("%lld", &n);
  return n;
}
int main() {
  std::string s;
  std::cin >> s;
  int n = s.size();
  int dp[n + 1][27];
  for (int i = 0; i <= 26; i++)
    for (int j = 0; j <= n; j++) dp[j][i] = 0;
  dp[0][26] = 0;
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j < 26; j++) {
      if (s[i] == j + 'a')
        dp[i + 2][26] = std::max(dp[i + 1][26], dp[i][j] + 1);
      else
        dp[i + 1][s[i] - 'a'] = std::max(dp[i + 1][s[i] - 'a'], dp[i][j] + 1);
    }
    dp[i + 1][s[i] - 'a'] = std::max(dp[i + 1][s[i] - 'a'], dp[i][26] + 1);
  }
  int res = 0;
  for (int i = 0; i <= 26; i++) res = std::max(res, dp[n][i]);
  std::cout << res << std::endl;
  return 0;
}
