#include <bits/stdc++.h>
using namespace std;
int main() {
  string str;
  cin >> str;
  int n = str.length();
  bool ch = true;
  int ans = 0;
  for (int i = 0; i < str.length(); ++i) {
    int cnt = 0, cnt2 = 0;
    int p = i;
    int j;
    for (j = i + 1; j < str.length() && str[i] == str[j]; ++j) {
      ++cnt;
    }
    for (int j = j + 1; j < str.length() && str[i] != str[j]; ++j) {
      ++cnt2;
    }
    ans += min(cnt, cnt2);
  }
  cout << ans << endl;
}
