#include <bits/stdc++.h>
using namespace std;
int main(void) {
  string S, S1, S2;
  int i = 0, ans = 0, p = 0, swi = 1, check = 0;
  cin >> S;
  int L = S.length();
  if (L == 1) {
    ans = 1;
  }
  if (L == 2) {
    if (S[0] != S[1]) {
      ans = 2;
    } else {
      ans = 1;
    }
  }
  if (L >= 3) {
    while (i <= L) {
      if (i == 0) {
        i++;
      } else {
        i += 2;
      }
      if (check == 1 && S[i - 1] != S[i] && S[i - 2] != S[i - 1]) {
        i--;
      }
      ans++;
      check = 1;
    }
  }
  cout << ans << endl;
}
