#include <bits/stdc++.h>
constexpr int atcoder_mod = 1e9 + 7;
using namespace std;
using ll = long long;
template <typename T = int>
T in() {
  T x;
  cin >> x;
  return (x);
}
template <typename T = int, typename C = vector<T>>
C vecin(int N) {
  C x(N);
  for (int i = 0; i < (N); ++i) {
    x[i] = in();
  }
  return move(x);
}
void vout() { cout << endl; }
template <typename Head, typename... Tail>
void vout(Head&& h, Tail&&... t) {
  cout << ' ' << h;
  vout(forward<Tail>(t)...);
}
void out() { cout << endl; }
template <typename Head, typename... Tail>
void out(Head&& h, Tail&&... t) {
  cout << h;
  vout(forward<Tail>(t)...);
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string S = in<string>();
  int N = S.size();
  int num = 0;
  bool flag = false;
  for (int i = 0; i < N;) {
    if (i > 0 && S[i] == S[i - 1]) {
      if (!flag) num--;
      if (i < N - 1) {
        num += 2;
        i += 3;
        flag = true;
      } else {
        num++;
        i += 2;
      }
    } else {
      if (flag) {
        num++;
        flag = false;
      }
      num++;
      i++;
    }
  }
  if (N == 1) num = 1;
  out(num);
  return 0;
}
