#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
using uint64 = unsigned long long;
using vi = vector<int>;
using vl = vector<int64>;
using pii = pair<int, int>;
using pll = pair<int64, int64>;
template <typename T>
inline void chmin(T &a, T b) {
  if (a > b) a = b;
  return;
}
template <typename T>
inline void chmax(T &a, T b) {
  if (a < b) a = b;
  return;
}
const int INF = (1 << 30) - 1;
const int64 INF64 = (1LL << 62) - 1;
const int MOD = 1000000007;
int dp[202020][3];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  string s;
  cin >> s;
  int n = s.size();
  dp[0][1] = 1;
  dp[0][2] = -INF;
  dp[1][1] = (s[0] == s[1]) ? -INF : 2;
  dp[1][2] = 1;
  dp[2][1] = max(dp[1][1], dp[1][2]) + 1;
  dp[2][2] = 2;
  for (int i = 3; i < n; ++i) {
    for (int j = 0; j < 3; ++j) {
      if (j == 0) continue;
      if (j == 1) {
        if (s[i - 1] == s[i]) {
          dp[i][j] = dp[i - 1][2] + 1;
        } else {
          dp[i][j] = max(dp[i - 1][1], dp[i - 1][2]) + 1;
        }
      } else if (j == 2) {
        if (s.substr(i - 1, 2) == s.substr(i - 3, 2)) {
          dp[i][j] = dp[i - 2][1] + 1;
        } else {
          dp[i][j] = max(dp[i - 2][1], dp[i - 2][2]) + 1;
        }
      }
    }
  }
  assert(max(dp[n - 1][1], dp[n - 1][2]) > 0);
  cout << max(dp[n - 1][1], dp[n - 1][2]) << '\n';
  return 0;
}
