#include <bits/stdc++.h>
using namespace std;
string S;
int f[2 << 17], N;
int main() {
  cin >> S;
  N = S.size();
  for (int i = 1; i < N; i++) {
    if (S[i - 1] != S[i]) f[i] = f[i - 1] + 1;
    if (S[i - 1] == S[i] && i > 2) f[i] = f[i - 2] + 2;
  }
  cout << f[N - 1] << endl;
}
