#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1000000007;
int main() {
  string s;
  cin >> s;
  int ans1 = 0, ans2 = 0, flag = 0;
  for (int i = 0; i < s.length() - 1; i++) {
    if (s[i] != s[i + 1] || flag == 1) {
      flag = 0;
    } else {
      i++;
      flag = 1;
    }
    ans1++;
  }
  if (flag == 0) ans1++;
  flag = 1;
  ans2 = 1;
  for (int i = 2; i < s.length() - 1; i++) {
    if (s[i] != s[i + 1] || flag == 1) {
      flag = 0;
    } else {
      i++;
      flag = 1;
    }
    ans2++;
  }
  if (flag == 0) ans2++;
  cout << max(ans1, ans2);
}
