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