#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  if (s.length() == 0 || s.length() == 1) {
    printf("%d\n", 0);
    return 0;
  }
  int count = 0;
  while (1) {
    int i = 0;
    for (i = 1; i < s.length(); i++) {
      if (s[i - 1] != s[i]) {
        count++;
        s.erase(s.begin() + i - 1, s.begin() + i + 1);
        break;
      }
    }
    if (i == s.length() - 1) break;
  }
  printf("%d\n", count * 2);
  return 0;
}
