#include <bits/stdc++.h>
using namespace std;
int main() {
  string str;
  cin >> str;
  int C[str.length()];
  C[0] = 0;
  C[1] = 1;
  if (str[1] == str[2])
    C[2] = 1;
  else
    C[2] = 2;
  for (int i = 3; i < str.length(); i++) {
    if (str[i] == str[i - 1]) {
      C[i] = C[i - 3] + 2;
    } else {
      C[i] = C[i - 1] + 1;
    }
  }
  cout << C[str.length() - 1] << endl;
  return 0;
}
