#include <bits/stdc++.h>
using namespace std;
const int inf = 1 << 25;
string s;
int dp[300000][2];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(10);
  cin >> s;
  int n = ((int)((s).size()));
  if (n == 1) {
    cout << 1 << "\n";
    return 0;
  }
  dp[0][0] = 1, dp[0][1] = -inf;
  dp[1][1] = 1, dp[0][0] = (s[0] != s[1] ? 2 : -inf);
  for (int i = 2; i < n; i++) {
    for (int j = 0; j < 2; j++) {
      dp[i][j] = -inf;
      for (int k = 0; k < 2; k++)
        if (i - j - 1 - k >= 0 &&
            (j != k ||
             s[i] != s[i - j - 1] && (j < 1 || s[i - 1] == s[i - j - 2])))
          dp[i][j] = max(dp[i][j], dp[i - j - 1][k] + 1);
    }
  }
  cout << max(dp[n - 1][0], dp[n - 1][1]) << "\n";
}
