#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  long long k1[200000];
  long long k2[200000];
  long long n = s.length();
  long long c11, c12, c21, c22;
  for (long long i = n - 1; i >= 0; i--) {
    if (i == n - 1) {
      c11 = 0;
      c12 = 0;
    } else {
      if (s[i] == s[i + 1]) {
        c11 = 0;
      } else {
        c11 = k1[i + 1] + 1;
      }
      if (i == n - 2) {
        c12 = 0;
      } else {
        c12 = k2[i + 1] + 1;
      }
    }
    if (i == n - 1) {
      c21 = 0;
      c21 = 0;
    } else if (i == n - 2) {
      c21 = 0;
      c21 = 0;
    } else {
      c21 = k1[i + 2] + 1;
      if (i == n - 3) {
        c22 = 0;
      } else if (s[i] == s[i + 2] && s[i + 1] == s[i + 3]) {
        c22 = 0;
      } else {
        c22 = k2[i + 1] + 1;
      }
    }
    k1[i] = max(c11, c12);
    k2[i] = max(c21, c22);
  }
  cout << max(k1[0], k2[0]) << endl;
  return 0;
}
