#include <bits/stdc++.h>
using namespace std;
int dp[200001][2];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  string s;
  cin >> s;
  if (s.size() == 1) {
    cout << 1 << endl;
    return 0;
  }
  memset(dp, -1, sizeof(dp));
  dp[1][0] = 1;
  dp[2][1] = 1;
  for (int i = 2; i < s.size(); i++) {
    for (int j = 0; j < (int)(2); j++)
      if (dp[i][j] != -1) {
        if (j == 1 || s[i - 1] != s[i]) {
          dp[i + 1][0] = max(dp[i + 1][0], dp[i][j] + 1);
        }
        if (i + 2 <= s.size() &&
            (j == 0 || s[i - 2] != s[i] || s[i - 1] != s[i + 1])) {
          dp[i + 2][1] = max(dp[i + 2][1], dp[i][j] + 1);
        }
      }
  }
  cout << max(dp[s.size()][0], dp[s.size()][1]) << endl;
  return 0;
}
