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