#include <bits/stdc++.h>
using namespace std;
const long long N = 300005;
string s;
long long dp[100001][2];
long long solve(long long i, long long b) {
  long long j = b;
  if (i == s.size()) return 0;
  if (dp[i][b] != -1) return dp[i][b];
  if (b == 0) {
    dp[i][j] = 0;
    if (i != s.size() - 1) dp[i][j] = 1 + solve(i + 2, 1);
    if (s[i] != s[i - 1]) dp[i][j] = max(dp[i][j], 1 + solve(i + 1, 0));
  }
  if (b == 1) dp[i][j] = 1 + solve(i + 1, 0);
  return dp[i][j];
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> s;
  if (s.size() == 1) return 1;
  for (long long i = 0; i < s.size(); i++) dp[i][0] = -1, dp[i][1] = -1;
  cout << 1 + max(solve(1, 0), solve(2, 1));
}
