#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int can1 = 1;
  int pos = 1;
  int l = 1;
  while (pos < s.length()) {
    ++can1;
    if (l == 2) {
      ++pos;
      l = 1;
    } else if (s[pos - 1] == s[pos]) {
      pos += 2;
      l = 2;
    } else
      ++pos;
  }
  if (l == 2) --can1;
  int can2 = 1;
  reverse(s.begin(), s.end());
  pos = 1;
  l = 1;
  while (pos < s.length()) {
    ++can2;
    if (l == 2) {
      ++pos;
      l = 1;
    } else if (s[pos - 1] == s[pos]) {
      pos += 2;
      l = 2;
    } else
      ++pos;
  }
  if (l == 2) --can2;
  cout << max(can1, can2) << endl;
}
