#include <bits/stdc++.h>
using namespace std;
const int max_n = 100011, max_m = 500011, inf = 1000111222;
const long long inff = 1000111222333444;
int dp[2][max_n];
int n;
int main() {
  string s;
  cin >> s;
  n = s.length();
  int cnt = 0;
  dp[0][0] = 1;
  dp[1][1] = 1;
  for (int i = 1; i < s.length(); ++i) {
    if (s[i] != s[i - 1]) {
      dp[0][i] = max(dp[0][i - 1], dp[1][i - 1]) + 1;
      if (i > 1) dp[1][i] = max(dp[1][i], max(dp[0][i - 2], dp[1][i - 2]) + 1);
    } else {
      dp[0][i] = dp[1][i - 1] + 1;
      dp[1][i] = max(dp[0][i - 2], dp[1][i - 2]) + 1;
    }
  }
  cout << max(dp[0][n - 1], dp[1][n - 1]) << endl;
  return 0;
}
