#include <bits/stdc++.h>
const int N = 3e5 + 5, MAX = 3e7, MOD = 1e9 + 7;
using namespace std;
string a;
int memo[N][2];
int solve(int indx, bool one) {
  if (indx >= ((int)(a).size())) return 0;
  int &ret = memo[indx][one];
  if (~ret) return ret;
  if (one) {
    if (a[indx] != a[indx - 1]) ret = max(ret, 1 + solve(indx + 1, !one));
    ret = max(ret, 1 + solve(indx + 2, 0));
  } else {
    ret = max(ret, 1 + solve(indx + 1, 1));
  }
  return ret;
}
int main() {
  cin >> a;
  memset(memo, -1, sizeof(memo));
  cout << solve(0, 0) - 1 << endl;
}
