#include <bits/stdc++.h>
const long long INF = 10000000000000;
const long long mod = 1e9 + 7;
using namespace std;
void add(int& a, int b) {
  a += b;
  if (a >= mod) a -= mod;
}
long long mul(long long a, long long b) { return (a * b) % mod; }
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  string s;
  cin >> s;
  int n = s.length();
  if (n == 1) return cout << 1 << endl, 0;
  vector<string> v;
  int fin = n - 2;
  int nb = 1;
  while (fin && s[fin] == s[n - 1]) {
    fin--;
    nb++;
  }
  for (int i = 0; i <= fin; i++) {
    string t = "";
    t += s[i];
    if (!v.size())
      v.push_back(t);
    else {
      if (v[v.size() - 1] == t) {
        t += s[i + 1];
        i++;
        v.push_back(t);
      } else
        v.push_back(t);
    }
  }
  cout << nb / 2 + nb % 2 + v.size() << endl;
  return 0;
}
