#include <bits/stdc++.h>
using namespace std;
string s;
int check(int x, int y) {
  string last = "";
  string nw = "";
  for (int i = 0; i < x; i++) last += (char)(s[i]);
  for (int i = x; i < x + y; i++) nw += (char)(s[i]);
  int num = 2;
  for (int i = x + y - 1; i < s.size(); i++) {
    if (i == s.size() - 1) {
      if (last == nw) num--;
      break;
    }
    if (last == nw) {
      nw += s[i + 1];
      num++;
      last = nw;
      nw = "";
      nw += s[i + 2];
      i++;
      continue;
    } else if (last != nw) {
      last = nw;
      nw = (char)(s[i + 1]);
      num++;
    }
  }
  return num;
}
int main() {
  cin >> s;
  if (s.size() == 1) {
    cout << 1 << endl;
    return 0;
  }
  if (s.size() == 2) {
    if (s[0] == s[1]) {
      cout << 1 << endl;
      return 0;
    } else {
      cout << 2 << endl;
      return 0;
    }
  }
  int mx = 0;
  mx = max(mx, check(1, 1));
  cout << mx << endl;
  return 0;
}
