#include <bits/stdc++.h>
using namespace std;
int main(void) {
  string s;
  cin >> s;
  string s1;
  char c;
  c = s[s.size() - 1];
  size_t same_num = 1;
  for (int i = s.size() - 2; i >= 0; i--) {
    if (c == s[i]) {
      same_num++;
    } else {
      break;
    }
  }
  int k = 1;
  s1 = s.substr(0, 1);
  size_t current_pos = 1;
  for (; current_pos < s.size() - same_num;) {
    if (s1 == s.substr(current_pos, 1)) {
      s1 = s.substr(current_pos, 2);
      current_pos += 2;
      k++;
    } else {
      s1 = s.substr(current_pos, 1);
      current_pos += 1;
      k++;
    }
  }
  int j = s.size() - current_pos;
  if (j == 0)
    ;
  else if (j <= 2)
    k += 1;
  else
    k += (j + 2) / 2;
  cout << k << endl;
  return 0;
}
