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