#include <bits/stdc++.h>
#pragma warning(disable : 4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;
string s;
int d[200010][3], n;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> s;
  n = s.length();
  d[0][1] = 1;
  d[1][2] = 1;
  if (s[0] != s[1]) d[1][1] = 2;
  for (int i = 2; i < n; i++) {
    if (d[i - 1][2]) d[i][1] = d[i - 1][2] + 1;
    if (d[i - 1][1] && d[i][1] < (d[i - 1][1] + 1) && s[i] != s[i - 1])
      d[i][1] = d[i - 1][1] + 1;
    if (d[i - 2][1]) d[i][2] = d[i - 2][1] + 1;
    if (i > 2 && d[i - 2][2] && d[i][2] < (d[i - 2][2] + 1) &&
        (s[i] != s[i - 2] || s[i - 1] != s[i - 3]))
      d[i][2] = d[i - 2][2] + 1;
  }
  printf("%d\n", max(d[n - 1][0], d[n - 1][1]));
  return 0;
}
