#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  long long n;
  cin >> s;
  n = s.length();
  long long count = 0;
  long long position = 1;
  if (n < 1) {
    cout << 0 << endl;
    return 0;
  }
  for (long long i = 1; i < n;) {
    if (s[i] != s[i - 1]) {
      s.erase(s.begin() + i);
      s.erase(s.begin() + i - 1);
      ++count;
      i = position;
      n -= 2;
      if (s.length() == 2) {
        if (s[0] == s[1]) break;
      } else if (s.length() < 2)
        break;
      else
        continue;
    } else {
      position = i;
    }
    ++i;
  }
  cout << count * 2 << endl;
  return 0;
}
