#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 7;
int main() {
  string s;
  cin >> s;
  long long count = 0;
  bool f = 1, k = 0, k2 = 0;
  for (int i = (0); i < (s.size() - 1); i++) {
    if (i == s.size() - 2) k = 1;
    if (i == s.size() - 3) k2 = 1;
    if (f) {
      count++;
      if (s[i] == s[i + 1]) f = 0;
    } else {
      count++;
      f = 1;
      i++;
    }
  }
  if (k == 0) count++;
  if (k2 && k)
    ;
  else if (s.size() > 1)
    if (s[s.size() - 1] != s[s.size() - 2]) count++;
  cout << count << endl;
}
