#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  bool frag = true;
  int count = 0;
  while (frag) {
    int n = s.length();
    for (int i = 0; i < n - 1; i++) {
      if (s[i] == s[i + 1]) {
        s.erase(i, i + 1);
        count += 2;
        i -= 1;
        n -= 2;
      }
    }
    if (n == s.length()) frag = false;
  }
  cout << count << endl;
}
