#include <bits/stdc++.h>
using namespace std;
int main() {
  string S, T;
  cin >> S;
  T = S[S.size() - 1];
  for (int i = 0; i < (S.size() - 2); i++) T += S[S.size() - 2 - i];
  string SS;
  SS = S[0];
  int ans = 0, c = 0;
  string TT;
  TT = T[0];
  int ans2 = 0, c2 = 0;
  if (S.size() == 1)
    cout << 1 << endl;
  else {
    for (int i = 0; i < (S.size() - 1); i++) {
      if (i) {
        if (SS.size() > 1 || SS[0] != S[i])
          SS = S[i];
        else {
          SS = S[i];
          SS += S[++i];
        }
        c = i;
      }
      ans++;
    }
    if (c == S.size() - 2 && SS.size() != 1 ||
        S[S.size() - 2] != S[S.size() - 1])
      ans++;
    for (int i = 0; i < (T.size() - 1); i++) {
      if (i) {
        if (TT.size() > 1 || TT[0] != T[i])
          TT = T[i];
        else {
          TT = T[i];
          TT += T[++i];
        }
        c2 = i;
      }
      ans2++;
    }
    if (c2 == T.size() - 2 && TT.size() != 1 ||
        T[T.size() - 2] != T[T.size() - 1])
      ans2++;
    cout << max(ans, ans2) << endl;
  }
}
