#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int n = s.size();
  vector<long long> a(n);
  if (s[0] == s[1])
    a[0] = 0;
  else
    a[0] = 1;
  a[1] = a[0] + 1;
  a[2] = a[1] + 1;
  for (int i = 3; i < n; i++) {
    if (s[i] == s[i - 1]) {
      a[i] = a[i - 3] + 2;
    } else {
      a[i] = a[i - 1] + 1;
    }
  }
  cout << a[n - 1] << endl;
  return 0;
}
