#include <bits/stdc++.h>
using namespace std;
const int inf = 1000000000;
const long long inff = 1000000000000000000;
int main() {
  string s;
  cin >> s;
  int ans = 1;
  int cou = 0;
  for (int i = 0; i < s.size() - 1; i++) {
    if (s[i] != s[i + 1])
      ans++;
    else if (s[i] == s[i + 1] && cou < 2)
      cou++;
    else if (s[i] == s[i + 1]) {
      ans++;
      cou = 0;
    }
  }
  cout << ans << endl;
  return 0;
}
