#include <bits/stdc++.h>
using namespace std;
int main() {
  char S[100000];
  cin >> S;
  int a = strlen(S);
  int m = 0;
  for (int i = 0; i < a; i++) {
    if (S[i] == S[i + 1]) {
      for (int j = i + 2; j < a; j++) {
        S[j] = S[j - 2];
      }
      m++;
      i = (i - 1);
    } else {
      i++;
    }
  }
  cout << m;
  return 0;
}
