#include <bits/stdc++.h>
using namespace std;
int test[101];
int main() {
  long long n, a = 0, sum = 0, ans = 0;
  string s;
  cin >> s;
  for (int h = 0; h < s.size(); h++) {
    if (h == 0) {
      ans++;
    } else if (h == s.size() - 2 && s[h] == s[h + 1]) {
      ans++;
      h = s.size();
    } else if (a != 0) {
      a = 0;
      ans++;
    } else if (s[h - 1] == s[h]) {
      a = 1;
      ans++;
      h++;
    } else {
      ans++;
    }
  }
  for (int h = 0; h < s.size(); h++) {
    if (h == 0) {
      sum++;
      h++;
      a = 1;
    } else if (h == s.size() - 2 && s[h] == s[h + 1]) {
      ans++;
      h = s.size();
    } else if (a != 0) {
      a = 0;
      sum++;
    } else if (s[h - 1] == s[h]) {
      a = 1;
      sum++;
      h++;
    } else {
      sum++;
    }
  }
  cout << max(sum, ans) << endl;
  cin >> n;
}
