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