#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long N = 2e5 + 6;
long long arr[N];
long long DP[N][3];
string input;
long long f(long long idx, long long cnt) {
  if (idx >= input.size()) return 0;
  if (DP[idx][cnt] != -1) return DP[idx][cnt];
  if (idx == 0) {
    long long ans1 = 1 + f(idx + 1, 1);
    long long ans2 = 1 + f(idx + 2, 2);
    return DP[idx][cnt] = max(ans1, ans2);
  } else {
    if (cnt == 1) {
      long long ans1 = -9999999999, ans2 = -9999999999;
      if (input[idx] != input[idx - 1]) {
        ans1 = 1 + f(idx + 1, 1);
        ans2 = 1 + f(idx + 2, 2);
      } else if (idx != input.size() - 1) {
        ans2 = 1 + f(idx + 2, 2);
      }
      return DP[idx][cnt] = max(ans1, ans2);
    } else {
      long long ans1 = 1 + f(idx + 1, 1);
      return DP[idx][cnt] = ans1;
    }
  }
}
void solve() {
  cin >> input;
  long long n = input.size();
  memset(DP, -1, sizeof(DP));
  cout << f(0, 0);
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
  return 0;
}
