#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int count = 0;
  for (int j = 0; j < s.size(); j++) {
    if (s[j] != s[j + 1] && s.size() > 1) {
      count += 2;
      s.erase(s.begin() + j);
    }
  }
  cout << count << endl;
}
