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