#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  string s;
  cin >> s;
  ll ans = 0;
  int prevlength = 0;
  int flag = 0;
  for (int i = 0; i < s.length() - 1; i++) {
    if (prevlength == 1) {
      if (s[i] != s[i + 1] && s[i] != s[i - 1]) {
        ans++;
        prevlength = 1;
        flag = 0;
      } else {
        ans++;
        i++;
        prevlength = 2;
        if (i == s.length() - 1) {
          flag = 1;
        } else {
          flag = 0;
        }
      }
    } else if (prevlength == 2) {
      ans++;
      prevlength = 1;
      flag = 0;
    } else {
      if (s[i] != s[i + 1]) {
        ans++;
        prevlength = 1;
        flag = 0;
      } else {
        ans++;
        i++;
        prevlength = 2;
        if (i == s.length() - 1) {
          flag = 1;
        } else {
          flag = 0;
        }
      }
    }
  }
  if (flag == 0) {
    ans++;
  }
  cout << ans << endl;
}
