#include <bits/stdc++.h>
using namespace std;
const long long int MaxN = 300005;
const long long int mod = 1e9 + 7;
const float pi = 3.1415926535897932384626433832795028;
long long int mcd(long long int a, long long int b) {
  if (a == 0) return b;
  return mcd(b % a, a);
}
long long int arr[MaxN];
void solve() {
  long long int N, i, j, res = 0, ans, p, q;
  string word;
  cin >> word;
  N = word.size();
  for (i = 0; i < N;) {
    if (word[i] == word[i + 1]) {
      res += 1;
      i += 2;
    } else {
      res += 1;
      i += 1;
    }
  }
  ans = res;
  res = 2;
  for (i = 3; i < N;) {
    if (word[i] == word[i + 1]) {
      res += 1;
      i += 2;
    } else {
      res += 1;
      i += 1;
    }
  }
  cout << max(res, ans);
}
int main() {
  long long int i, t;
  t = 1;
  for (i = 1; i <= t; i++) {
    solve();
  }
}
