#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
const long long mod = 1e9 + 7;
void chmod(long long& M) {
  if (M >= mod)
    M %= mod;
  else if (M < 0) {
    M += (abs(M) / mod + 1) * mod;
    M %= mod;
  }
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  int n = s.length();
  s = '0' + s;
  vector<vector<int>> dp(n + 2, vector<int>(4, -1));
  dp[1][0] = 1;
  dp[2][1] = 1;
  dp[3][2] = 1;
  dp[4][3] = 1;
  for (int i = 2; i <= n; ++i) {
    for (int j = 0; j < 4; ++j) {
      if (i - 2 * j - 1 <= 0) continue;
      if (s.substr(i - 2 * j - 1, j + 1) != s.substr(i - j, j + 1)) {
        for (int k = 0; k < 4; ++k)
          if (i - j - 1 - k > 0) chmax(dp[i][j], dp[i - j - 1][k] + 1);
      } else {
        for (int k = 0; k < 4; ++k)
          if (i - j - 1 - k > 0 && k != j)
            chmax(dp[i][j], dp[i - j - 1][k] + 1);
      }
    }
  }
  int ans = 0;
  for (int j = 0; j < 4; ++j) chmax(ans, dp[n][j]);
  cout << ans << endl;
  return 0;
}
