#include <bits/stdc++.h>
using namespace std;
int bunkatu(string s) {
  if (s.length() == 1)
    return 1;
  else if (s[s.length() - 1] != s[s.length() - 2]) {
    string s2 = s.substr(0, s.length() - 1);
    return bunkatu(s2) + 1;
  } else if (s.length() == 2)
    return 1;
  else if (s.length() == 3)
    return 2;
  else {
    string s2 = s.substr(0, s.length() - 3);
    return bunkatu(s2) + 2;
  }
}
int main() {
  string s;
  cin >> s;
  cout << bunkatu(s) << endl;
}
