#include <bits/stdc++.h>
using namespace std;
int fnc(string s) {
  int x = s.size();
  if (x == 1)
    return 1;
  else if (x == 2) {
    if (s.at(0) == s.at(1))
      return 1;
    else
      return 2;
  } else if (x == 3) {
    if (s.at(0) == s.at(1) || s.at(1) == s.at(2)) {
      return 2;
    } else
      return 3;
  } else if (s.at(x - 2) != s.at(x - 1))
    return fnc(s.substr(0, x - 1)) + 1;
  else if (s.at(x - 2) == s.at(x - 1))
    return fnc(s.substr(0, x - 3)) + 2;
}
int main() {
  string s;
  cin >> s;
  cout << fnc(s) << endl;
}
