#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int n = s.length();
  char c[n];
  int ans = n;
  for (int i = 0; i < n; i++) {
    c[i] = s.at(i);
  }
  int ind = 0;
  while (n > 0) {
    if (ind > n - 1) {
      break;
    } else if (c[ind] == c[ind + 1]) {
      ans--;
      ind += 2;
      n -= 2;
    } else {
      ind++;
    }
  }
  cout << ans << endl;
}
