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