#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  string s;
  cin >> s;
  int cnt = 0, end = 0;
  while (!end) {
    for (int i = 0; i < s.size() - 1; ++i) {
      if (s[i] != s[i + 1]) {
        s.erase(s.begin() + i, s.begin() + i + 2);
        cnt += 2;
        break;
      }
      if (i == s.size() - 2) end++;
    }
  }
  cout << cnt << endl;
  return 0;
}
