#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int l = s.size();
  vector<bool> f(l, true);
  int c1 = 0, c2 = 1, ans = 0;
  while (c2 < l) {
    if (s.at(c1) != s.at(c2)) {
      f.at(c1) = false;
      f.at(c2) = false;
      ans += 2;
      c2++;
      while (1) {
        c1--;
        if (c1 < 0) {
          c1 = c2;
          c2++;
          break;
        } else {
          if (f.at(c1)) break;
        }
      }
    } else {
      c1 = c2;
      c2++;
    }
  }
  cout << ans << endl;
  return 0;
}
