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