#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  string S;
  cin >> S;
  int size_S = S.size();
  if (size_S == 1) {
    cout << 1 << endl;
    return 0;
  }
  vector<vector<pair<int, string>>> DP(size_S,
                                       vector<pair<int, string>>(size_S));
  DP.at(0).at(0) = make_pair(1, S.at(0));
  DP.at(0).at(1) = make_pair(1, S.substr(0, 2));
  if (DP.at(0).at(0).second != S.substr(1, 1)) {
    DP.at(1).at(1).first = 2;
  }
  DP.at(1).at(1).second = S.substr(1, 1);
  int num, num2;
  for (int i = 2; i < size_S; ++i) {
    for (int j = i; j < i + 2 && j < size_S; ++j) {
      num = j - i + 1;
      DP.at(i).at(j).second = S.substr(i, num);
      if (num == 1)
        num2 = 2;
      else
        num2 = 1;
      if (DP.at(i - num).at(i - 1).second != S.substr(i, num)) {
        DP.at(i).at(j).first = max(DP.at(i - num).at(i - 1).first + 1,
                                   DP.at(i - num2).at(i - 1).first + 1);
      } else {
        DP.at(i).at(j).first = DP.at(i - num2).at(i - 1).first + 1;
      }
    }
  }
  cout << max(DP.at(size_S - 1).at(size_S - 1).first,
              DP.at(size_S - 2).at(size_S - 1).first)
       << endl;
  return 0;
}
