#include <bits/stdc++.h>
using namespace std;
const int MOD = (int)1e9 + 7;
int main() {
  string S;
  cin >> S;
  int ans1 = 1;
  char now = S.at(0);
  bool flag = false;
  for (int i = 1; i < S.size(); i++) {
    if (flag) {
      flag = false;
      now = S.at(i);
      ans1++;
    } else {
      if (now == S.at(i)) {
        flag = true;
        ans1++;
        i++;
      } else {
        flag = false;
        now = S.at(i);
        ans1++;
      }
    }
  }
  if (flag == true && S.at(S.size() - 2) == S.at(S.size() - 1)) ans1--;
  int ans2 = 1;
  flag = true;
  for (int i = 2; i < S.size(); i++) {
    if (flag) {
      flag = false;
      now = S.at(i);
      ans2++;
    } else {
      if (now == S.at(i)) {
        flag = true;
        ans2++;
        i++;
      } else {
        flag = false;
        now = S.at(i);
        ans2++;
      }
    }
  }
  if (flag == true && S.at(S.size() - 2) == S.at(S.size() - 1)) ans2--;
  cout << max(ans1, ans2) << endl;
  return 0;
}
