#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  int count = 0;
  int N;
  N = S.length();
  vector<vector<int>> D(N, vector<int>(2));
  D[0][0] = 1;
  D[0][1] = 1;
  for (int i = 1; i < N; i++) {
    if (S[i] == S[i - 1]) {
      D[i][0] = D[i - 1][1] + 1;
      D[i][1] = D[i - 1][0];
    } else {
      D[i][0] = D[i - 1][0] + 1;
      D[i][1] = D[i - 1][0];
    }
  }
  cout << max(D[N - 1][0], D[N - 1][1]) << endl;
  return 0;
}
