#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int ans = 0;
  bool f = true;
  while (f) {
    f = false;
    for (int i = 0; i < s.size() - 1; i++) {
      if (s[i] != s[i + 1] && s[i] != '@') {
        f = true;
        ans += 2;
        s[i] = '@';
        s[i + 1] = '@';
      }
    }
    string t = "";
    for (int i = 0; i < (s.size()); i++) {
      if (s[i] != '@') t += s[i];
    }
    s = t;
  }
  cout << ans << endl;
  return 0;
}
