#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int ans = 1, k = 0, l = 0, m;
  for (int i = 0; i < s.size() - 1; i++) {
    if (s[i] == s[i + 1]) {
      k++;
    } else {
      ans += 1 + k / 2;
      if (k == 1 && l == 1) {
        ans++;
        k--;
      }
      l = k;
      k = 0;
    }
  }
  ans += k / 2;
  cout << ans << endl;
  return 0;
}
