#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
void solve() {
  string str;
  cin >> str;
  int ans = 0;
  char s = str[0];
  for (int i = 1; i < str.size() - 1; i++) {
    if (str[i] != str[i + 1]) str[i + 1] = s, ans += 2;
  }
  cout << ans << endl;
}
int main() {
  solve();
  return 0;
}
