#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9 + 17;
const long long MOD = 1e9 + 7;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  int n = s.size();
  vector<int> dp(n, 0);
  dp[0] = 1;
  dp[1] = (dp[0] == dp[1] ? 1 : 2);
  for (int i = 2; i < n; i++)
    if (s[i] == s[i - 1])
      dp[i] = dp[i - 2] + 1;
    else
      dp[i] = 1 + max(dp[i - 1], dp[i - 2]);
  cout << dp[n - 1] << '\n';
  return 0;
}
