#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  char old_char = 0;
  int old_length;
  int now_length;
  int cnt = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == old_char) {
      old_length = 1;
      now_length = 1;
      while (true) {
        i++;
        if (i == s.size()) {
          cout << cnt << endl;
          return 0;
        }
        if (s[i] != old_char) {
          cnt++;
          old_char = 0;
          if (now_length == 0) {
            old_char = s[i];
          }
          break;
        } else {
          now_length++;
          if (now_length > old_length) {
            now_length = 0;
            old_length++;
            cnt++;
          }
        }
      }
    } else {
      cnt++;
      old_char = s[i];
    }
  }
  cout << cnt << endl;
  return 0;
}
