#include <bits/stdc++.h>
int main(void) {
  std::string s;
  std::cin >> s;
  int pos = 0;
  int repos = 0;
  int ans = 0;
  if (s.size() < 2) {
    std::cout << 0 << std::endl;
    return 0;
  }
  while (true) {
    if (s[pos] != s[pos + 1]) {
      s = s.substr(0, pos) + s.substr(pos + 2, s.size() - (pos + 2));
      repos = pos;
      ans += 2;
    }
    if (pos + 2 >= s.size()) {
      pos = -1;
      if (s.size() == 2) {
        if (s[0] == s[1]) {
          std::cout << ans << std::endl;
          return 0;
        }
      }
    }
    pos++;
    if (pos == repos) {
      std::cout << ans << std::endl;
      return 0;
    }
  }
  return 0;
}
