#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long INF = mod * mod;
const long double eps = 1e-8;
const long double pi = acos(-1.0);
string s;
void solve() {
  cin >> s;
  int n = s.size();
  int ans = 0;
  int j = 0;
  char t = '?';
  while (j < n) {
    if (j == n - 1) {
      if (t != s[j]) {
        ans++;
        j++;
      } else {
        j++;
      }
    }
    if (j == n - 2) {
      if (s[j] != t && s[j] != s[j + 1]) {
        ans += 2;
        j += 2;
      } else {
        ans += 1;
        j++;
      }
    }
    if (s[j] != t) {
      if (j > 0) ans++;
      t = s[j];
      j++;
    }
    if (s[j] == t) {
      ans += 2;
      t = s[j + 2];
      j += 3;
    }
  }
  cout << ans << endl;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  solve();
  return 0;
}
