#include <bits/stdc++.h>
using namespace std;
int main() {
  int count = 0;
  stack<int> s;
  string S;
  cin >> S;
  s.push(S.at(0));
  for (int i = 1; i < S.size(); i++) {
    if (S.at(i) != s.top()) {
      s.pop();
      count += 2;
    }
  }
  cout << count << endl;
}
