#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
const long long INF = 20000000000;
const int MOD = 1000000007;
long long max(long long a, long long b) {
  if (a < b)
    return b;
  else
    return a;
}
long long min(long long a, long long b) {
  if (a > b)
    return b;
  else
    return a;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  string s;
  cin >> s;
  vector<long long> dp(s.length() + 3, 0);
  long long ans = 0;
  dp[1] = 1;
  for (int i = 1; i <= s.length(); i++) {
    dp[i + 2] = max(dp[i + 2], dp[i] + 1);
    if (s[i] != s[i + 1]) dp[i + 1] = max(dp[i + 1], dp[i] + 1);
  }
  cout << dp[s.length()] << endl;
}
