#include <bits/stdc++.h>
int main() {
  char str[200001];
  scanf("%s", str);
  int i = 1;
  int len = strlen(str);
  int div = 0;
  while (i < len - 1) {
    if (str[i] == str[i + 1] && str[i] != str[i - 1]) div++;
    if (str[i] != str[i + 1] && str[i] == str[i - 1]) div++;
    if (str[i] != str[i + 1] && str[i] != str[i - 1]) div++;
    i++;
  }
  printf("%d\n", div);
  return (0);
}
