#include <bits/stdc++.h>
using namespace std;
int main() {
  string S, RS;
  cin >> S;
  RS = S;
  reverse(RS.begin(), RS.end());
  int count1 = 1;
  int size = S.size();
  for (int i = 0; i < size - 1; i++) {
    count1++;
    if (S.at(i) == S.at(i + 1)) i++;
  }
  int count2 = 1;
  for (int i = 0; i < size - 1; i++) {
    count2++;
    if (RS.at(i) == RS.at(i + 1)) i++;
  }
  cout << max(count1, count2) << endl;
}
