#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int i, j, a;
  string s;
  cin >> s;
  a = 0;
label:
  i = 0;
  while (i < s.length()) {
    j = 0;
    while (j < s.length() - 1) {
      if (s[j] != s[j + 1] && s.length() > 2) {
        s.erase(j, 2);
        a += 2;
        j--;
      } else if (s[j] != s[j + 1] && s.length() == 2) {
        s.erase(j, 2);
        a += 2;
        break;
      }
      j++;
    }
    i++;
  }
  cout << a << endl;
  return 0;
}
