#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  string t;
  int ans = 0;
  t = ".";
  for (int i = 0; i < s.length() - 1; i++) {
    if (t.length() > 1) {
      t = s[i];
    } else if (t[0] == s[i]) {
      t = s.substr(i, 2);
      i += 1;
    } else {
      t = s[i];
    }
    ans += 1;
  }
  if (t[0] == s[s.length() - 1] && t.length() == 1) {
  } else {
    ans += 1;
  }
  cout << ans << endl;
  return 0;
}
