#include <bits/stdc++.h>
using namespace std;
int main(void) {
  string s;
  cin >> s;
  int now = 0;
  int samenum = 0;
  int result = 0;
  while (now < s.size() - 1) {
    if (s[now] != s[now + 1]) {
      if (samenum == 0) {
        result++;
        now++;
        continue;
      } else if (samenum == 1) {
        result += 2;
        now += 2;
        samenum = 0;
      } else {
        result += 2;
        now++;
        samenum = 0;
      }
    } else if (s[now] == s[now + 1]) {
      if (now == s.size() - 2) {
        result++;
        break;
      }
      samenum++;
      now++;
    }
  }
  if (s[s.size() - 2] != s[s.size() - 1]) result++;
  cout << result;
  return 0;
}
