#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long long N;
  string S;
  cin >> S;
  N = S.size();
  char head = S[0];
  int counter = 0;
  for (int i = 1; i < N; i++) {
    if (head != S[i]) {
      counter++;
    }
  }
  cout << counter * 2 << endl;
  return 0;
}
