#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const long long mod = 1e9 + 7;
void print(stack<string> s) {
  cout << "Stack content : ";
  while (!s.empty()) {
    cout << s.top() << " ";
    s.pop();
  }
}
void solve(string &s) {
  long long n = s.size();
  string t = "";
  stack<string> f;
  for (long long x = 0; x < n; x++) {
    t.push_back(s[x]);
    if (f.empty()) {
      f.push(t);
      t = "";
      continue;
    }
    if (x == n - 2) {
      if (s[x] == s[x + 1]) {
        t.push_back(s[x + 1]);
        f.push(t);
        break;
      }
    }
    if (f.top() != t) {
      f.push(t);
      t = "";
      continue;
    }
  }
  cout << f.size() << '\n';
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  string s;
  cin >> s;
  solve(s);
  return 0;
}
