#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> memoization(3, vector<int>(200003, -1));
int answer(string& s, int k, int ends_with) {
  if (memoization[ends_with][k] != -1) {
    return memoization[ends_with][k];
  }
  if (k == 1) {
    return 1;
  }
  if (k <= 0) {
    return 0;
  }
  int ret = 0;
  for (int i = (1); i < (1) + (2); ++i) {
    if (k >= ends_with + i) {
      if (s.substr(k - ends_with, ends_with) != s.substr(k - i - ends_with, i))
        ret = max(ret, 1 + answer(s, k - ends_with, i));
    }
  }
  memoization[ends_with][k] = ret;
  return ret;
}
int main() {
  cout.precision(17);
  long long modd = 1000 * 1000 * 1000 + 7;
  mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
  uniform_int_distribution<int> rand_gen(0, modd);
  long long infinit = 10000000000000000;
  int test_cases = 1;
  for (int t = (1); t < (1) + (test_cases); ++t) {
    string s;
    cin >> s;
    cout << max(answer(s, s.size(), 1), answer(s, s.size(), 2)) << endl;
  }
  return 0;
}
