#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
int main() {
  string S;
  cin >> S;
  vector<int> dp(S.size() + 1, 0);
  if (S.size() == 1) {
    cout << 1 << endl;
    return 0;
  }
  if (S.size() == 2) {
    int ans = S[0] == S[1] ? 1 : 2;
    cout << ans << endl;
    return 0;
  }
  if (S.size() == 3) {
    int ans = S[0] == S[1] || S[1] == S[2] ? 2 : 3;
    cout << ans << endl;
    return 0;
  }
  dp[1] = 1;
  dp[2] = S[0] == S[1] ? 1 : 2;
  dp[3] = dp[2] + 1;
  for (int i = (4); i < (S.size() + 1); ++i) {
    dp[i] = S[i] == S[i - 1] ? dp[i - 3] + 2 : dp[i - 1] + 1;
  }
  cout << dp[S.size()] << endl;
  return 0;
}
