#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<char> sta(1e5);
  string s;
  cin >> s;
  int ans = 0, top = 0;
  for (int i = 0; i < s.size(); i++) {
    if (top == 0 || sta[top] == s[i])
      s[++top];
    else {
      ans += 2;
      top--;
    }
  }
  cout << ans << endl;
}
