#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long nmax = 1000003;
vector<long long> v;
long long ans;
long long f(long long first) { return (first / 3) * 2 + (first % 3 > 0); }
int32_t main() {
  string s;
  cin >> s;
  long long now = 0;
  for (long long i = 0; i < s.size(); i++) {
    long long cur = 1;
    while (i + 1 < s.size() && s[i + 1] == s[i]) cur++, i++;
    if (cur == 1) {
      ans++;
      ans += (f(now));
      now = 0;
    } else
      now += cur;
  }
  ans += f(now);
  cout << ans;
}
