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