 #include<bits/stdc++.h>

using namespace std;

int main(){
  string S;
  cin >> S;

  stack<string> c;
  int count = 0;
  for(int i = 0; i < S.size(); i++){
    if(c.empty() == 1 || c.top() == S[i]) c.push(S[i]);
    else { c.pop(); count += 2; }
  }

  cout << count << endl;

 return 0;
}



