#include <bits/stdc++.h>
using namespace std;
long long a, cnt = 1, b = 0;
string s;
signed main() {
  cin >> s;
  for (long long i = 0; i < s.size() - 1; i++) {
    if (s[i + 1] != s[i]) {
      if (cnt < 3) {
        b += 1;
      } else {
        b += 2;
      }
      cnt = 1;
    } else {
      cnt++;
    }
  }
  if (cnt > 1) {
    b += 1;
  }
  cout << b + 1;
}
