#include <bits/stdc++.h>
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
using namespace std;
using Graph = vector<vector<long long>>;
long long gcd(long long a, long long b) {
  if (a < b) swap(a, b);
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
  long long g = gcd(a, b);
  return a / g * b;
}
bool prime(long long n) {
  for (long long i = 2; i <= sqrt(n); i++) {
    if (n % i == 0) return false;
  }
  return n != 1;
}
const long long MOD = 1000000007;
const long long INF = 1LL << 50;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  string s;
  cin >> s;
  long long n = s.size();
  vector<long long> g(n);
  g[0] = 0;
  for (long long i = 1; i < n; i++) {
    if (s[i - 1] != s[i]) {
      g[i] = g[i - 1] + 1;
    } else {
      if (i >= 3) g[i] = g[i - 3] + 2;
    }
  }
  cout << g[n - 1] + 1 << endl;
  return 0;
}
