#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int t = 0;
  cin >> s;
  for (int i = 0; i < s.size() - 1; i++) {
    if (s[i] == s[i + 1]) {
      if (s[i] == s[s.size() - 3]) {
        t++;
        break;
      } else if (s[i] != s[s.size() - 3]) {
        t += 2;
        i += 2;
      }
    } else
      t++;
  }
  t++;
  cout << t << endl;
  return 0;
}
