#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int count = 0;
  int y = 0;
  bool ya = false;
  int len = s.length();
  for (int i = 0; i < len; i++) {
    bool o = false;
    string g;
    if (i > 1) {
      if (s[i - 1] == s[i]) o = true;
    }
    g = s[i + 1];
    if (ya && (s[i - 1] != s[i]) && (s[i] != s[i + 1])) {
      count++;
      ya = false;
    } else if ((s[i] == s[i + 1]) || o) {
      count += 2;
      i += 2;
      y = i;
      ya = true;
    } else if ((s[i] != s[i + 1])) {
      count++;
    }
  }
  cout << count;
}
