#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
int main() {
  string S;
  cin >> S;
  int s = S.size();
  int ans = 0;
  for (long long i = 0; i < s - 1; ++i) {
    if (S[i] != S[i + 1] && i != s - 2) {
      ans++;
    } else if (S[i] != S[i - 1] && i == s - 2) {
      ans += 2;
    } else if (i != s - 2) {
      ans += 2;
      i += 2;
      if (i == s - 2 || i == s - 1) {
        ans++;
      }
    } else {
      ans++;
    }
  }
  cout << ans << endl;
}
