#include <bits/stdc++.h>
using namespace std;
class NyaGadgetCpp17 {
 public:
  template <typename T>
  static T Gcd(T a, T b) {
    return b ? Gcd(b, a % b) : a;
  }
};
int main() {
  string s;
  cin >> s;
  if (s.size() == 1) {
    cout << 0;
    return 0;
  }
  int index = 0;
  int count = 0;
  while (1) {
    if (index == s.size() - 2) break;
    if (s[index] != s[index + 1]) {
      count++;
      s.replace(index, 2, "");
      if (index != 0) index--;
    } else {
      index++;
    }
  }
  cout << count * 2;
  return 0;
}
