#include <bits/stdc++.h>
using namespace std;
signed main() {
  string s;
  cin >> s;
  auto solve = [](string const& s) {
    int k = 1;
    bool two = false;
    for (int i = 1; i < s.size(); ++i) {
      if (s[i] == s[i - 1]) {
        if (two) {
          k++;
          two = false;
        } else {
          two = true;
        }
      } else {
        k++;
        two = false;
      }
    }
    if (two) k++;
    return k;
  };
  int ans = solve(s);
  reverse(begin(s), end(s));
  ans = max(ans, solve(s));
  cout << (ans) << endl;
}
