#include <bits/stdc++.h>
int unification(char *str) {
  int i;
  int j;
  int count;
  i = 0;
  count = 0;
  while (str[j] || str[i]) {
    j = i + 1;
    if (str[i] != str[j]) {
      str[i] = '2';
      str[j] = '2';
      count++;
      i += 2;
      continue;
    }
    i++;
  }
  return (count);
}
int main(void) {
  char s[100000];
  int res;
  scanf("%s", s);
  res = unification(s);
  printf("%d\n", res);
}
