#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
long long dp[300200][2];
signed main() {
  string s;
  cin >> s;
  dp[0][0] = 1;
  dp[1][1] = 1;
  if (s.size() == 1) {
    cout << 1;
    return 0;
  }
  if (s[0] == s[1])
    dp[1][0] = 0;
  else
    dp[1][0] = 2;
  for (long long i = 0; i + 1 < s.size(); ++i) {
    for (long long j = 0; j < 2; ++j) {
      if (dp[i][j] == 0) continue;
      if (j == 0) {
        if (s[i] != s[i + 1])
          dp[i + 1][0] = max(dp[i][j] + 1, dp[i + 1][0]);
        else if (i + 2 < s.size())
          dp[i + 2][1] = max(dp[i][j] + 1, dp[i + 2][1]);
      } else {
        if (dp[i][1] == 0) continue;
        dp[i + 1][0] = max(dp[i][j] + 1, dp[i + 1][0]);
        if (i + 2 < s.size() && (s[i - 1] + s[i]) != (s[i + 1] + s[i + 2]))
          dp[i + 2][0] = max(dp[i + 2][0], dp[i][j] + 1);
      }
    }
  }
  cout << max(dp[(long long)s.size() - 1][0], dp[(long long)s.size() - 1][1]);
  return 0;
}
