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