#include <bits/stdc++.h>
using namespace std;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const long long INFLL = 1001001001001001001;
const long long MODLL = (long long)1e9 + 7;
const double EPS = 1e-9;
int main() {
  string s;
  cin >> s;
  int n = s.length();
  string t = "";
  t += s[0];
  int count1 = 1;
  for (int i = 1; i < n - 1;) {
    if (t.length() == 1) {
      if (t[0] == s[i]) {
        t = "";
        t += s[i];
        t += s[i + 1];
        count1++;
        i += 2;
      } else {
        t = "";
        t += s[i];
        count1++;
        i += 1;
      }
    } else {
      t = "";
      t += s[i];
      count1++;
      i += 1;
    }
  }
  if (t.length() == 1 && t[0] != s[n - 1]) {
    count1++;
  }
  t = "";
  t += s[0];
  t += s[1];
  int count2 = 1;
  for (int i = 1; i < n - 1;) {
    if (t.length() == 1) {
      if (t[0] == s[i]) {
        t = "";
        t += s[i];
        t += s[i + 1];
        count2++;
        i += 2;
      } else {
        t = "";
        t += s[i];
        count2++;
        i += 1;
      }
    } else {
      t = "";
      t += s[i];
      count2++;
      i += 1;
    }
  }
  if (t.length() == 1 && t[0] != s[n - 1]) {
    count2++;
  }
  cout << min(count1, count2) << endl;
  return 0;
}
