#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
int m, n, k, ans, l, r, u, v, x, tc, y, q, sz, d, dp[N][2], a[N];
char s[N];
set<long long> cnt;
int solve(int idx, int need) {
  if (idx >= n) return 0;
  int &r = dp[idx][need];
  if (~r) return r;
  bool ok = false;
  if (!need) {
    if (s[idx] != s[idx + 1])
      r = 1 + solve(idx + 1, 0);
    else
      r = 1 + solve(idx + 1, 1);
  }
  r = max(r, 1 + solve(idx + 2, 0));
  return r;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  memset(dp, -1, sizeof dp);
  scanf("%s", s);
  n = strlen(s);
  printf("%d", solve(0, 0));
}
