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