#include <bits/stdc++.h>
using namespace std;
int main() {
  long long counter;
  counter = 0;
  string S;
  cin >> S;
  int N;
  N = S.size();
  char a = S.at(0);
  if (N == 1) {
    cout << 1 << endl;
  } else if (N == 2) {
    if (S.at(0) == S.at(1)) {
      cout << 1 << endl;
    } else
      cout << 2 << endl;
  } else {
    for (int i = 0; i < N - 2; i++) {
      if (S.at(i + 1) == S.at(i + 2)) {
        counter += 2;
        i += 2;
      } else if (S.at(i) == S.at(i + 1)) {
        i += 2;
        counter += 2;
      } else
        counter++;
    }
    if (S.at(N - 1) == S.at(N - 2))
      a = '0';
    else if (S.at(N - 3) == S.at(N - 2)) {
      a = '0';
    } else
      counter += 2;
    cout << counter << endl;
  }
}
