#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string S;
  cin >> S;
  vector<char> vec;
  vec.push_back(S[0]);
  long long count = 0;
  for (int i = 1; i < S.length(); ++i) {
    if (vec.front() != S[i]) {
      count += 2;
      vec.pop_back();
    } else {
      vec.push_back(S[i]);
    }
  }
  cout << count << endl;
}
