#include <bits/stdc++.h>
using namespace std;
stack<char> p;
int main() {
  string s;
  cin >> s;
  int n = s.length();
  int count = 0;
  p.push(s[0]);
  for (int i = 1; i < n; i++) {
    if (p.top() != s[i]) {
      p.pop();
      count++;
    } else
      p.push(s[i]);
  }
  cout << count * 2 << endl;
  return 0;
}
