#include <bits/stdc++.h>
using namespace std;
int main() {
  string str;
  cin >> str;
  int n = str.length();
  string last = "";
  int i = 0;
  int ans = 0;
  while (i < n) {
    string x = str.substr(i, 1);
    i++;
    if (i == n) {
      if (x == last)
        break;
      else {
        ans++;
        break;
      }
    }
    while (i < n && x == last) {
      x += str[i];
      i++;
    }
    if (i == n) break;
    ans++;
    last = x;
  }
  cout << ans << "\n";
  return 0;
}
