#include <bits/stdc++.h>
using namespace std;
long long pow(long long a, int b) {
  return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1;
}
template <typename T>
T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  int g[200001] = {0};
  g[0] = 0;
  g[1] = 1;
  if (s[0] != s[1])
    g[2] = 2;
  else
    g[2] = 1;
  for (int i = 2; i < ((int)s.size()); ++i) {
    if (s[i] != s[i - 1])
      g[i] = g[i - 1] + 1;
    else
      g[i] = g[i - 3] + 2;
  }
  cout << g[(int)s.size() - 1] << endl;
}
