#include <bits/stdc++.h>
int func(std::string s, int n) {
  std::string ns;
  for (int i = 1; i < (int)(s.length()); ++i) {
    if (s[i] != s[i - 1]) {
      n += 2;
      ns = s.substr(0, i - 1) + s.substr(i + 1);
      n = func(ns, n);
      break;
    }
  }
  return n;
}
int main(int argc, char const *argv[]) {
  std::string S;
  int N, count = 0;
  std::cin >> S;
  N = (int)(S.length());
  count = func(S, 0);
  std::cout << count << std::endl;
  return 0;
}
