#include <bits/stdc++.h>
auto main() -> int {
  std::string S{};
  std::cin >> S;
  std::uint64_t ans = 0;
  bool modified;
  do {
    modified = false;
    for (auto s1 = S.begin(); s1 < S.end() - 1;) {
      if (*s1 == '-') {
        ++s1;
        continue;
      }
      auto s2 = s1 + 1;
      for (; s2 < S.end(); ++s2) {
        if (*s2 == '-') {
          continue;
        }
        if (*s1 != *s2) {
          *s1 = '-';
          *s2 = '-';
          ans += 2;
          modified = true;
          s1 = s2 + 1;
        } else {
          s1 = s2;
        }
        break;
      }
    }
  } while (modified);
  std::cout << ans << std::endl;
}
