#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int n, ans = 0;
  bool flag = 1;
  ;
  cin >> s;
  while (flag) {
    flag = 0;
    n = s.size();
    for (int i = 0; i < n - 1; i++) {
      if (s[i] != s[i + 1]) {
        flag = 1;
        ans += 2;
        s = s.substr(0, i) + s.substr(i + 2, n);
        break;
      }
    }
  }
  cout << ans << endl;
}
