#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int n = s.size();
  int cnt = 0;
  bool flag;
  if (n == 2) {
    if (s[0] != s[1]) cnt = 2;
  } else {
    do {
      flag = true;
      for (int i = 0; i < n - 1; i++) {
        if (i == 0) continue;
        if (s[i + 1] != s[i]) {
          s[i + 1] = s[i];
          cnt += 2;
          flag = false;
        }
      }
    } while (not flag);
  }
  cout << cnt << endl;
}
