#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  S = " " + S;
  long long N = (int)S.size();
  int g[N];
  g[0] = 0, g[1] = 1;
  if (S.at(1) == S.at(2))
    g[2] = 1;
  else
    g[2] = 2;
  for (int i = 3; i < N; i++) {
    if (S.at(i) != S.at(i - 1)) {
      g[i] = g[i - 1] + 1;
    } else {
      g[i] = g[i - 3] + 2;
    }
  }
  return 0;
}
