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