#include <bits/stdc++.h>
using namespace std;
int main() {
  string str;
  cin >> str;
  int ans = 0;
  bool move;
  do {
    move = false;
    for (int i = 0; i + 2 <= str.size(); i++) {
      if (str[i] != str[i + 1]) {
        move = true;
        ans += 2;
        str = str.substr(0, i) + str.substr(i + 2);
      }
    }
  } while (move);
  cout << ans << "\n";
}
