#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  vector<char> c;
  string s2;
  cin >> s;
  for (int i = 0; i < s.length(); i++) {
    char a = s[i];
    c.push_back(a);
  }
  int slen = s.length();
  int res;
  for (int i = 1; i <= slen; i++) {
    if (c[i + 1] == c[i]) {
      if (c[i] != c[i + 2]) res++;
    }
  }
  cout << c.size() - res << endl;
}
