#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  string s;
  int no_cubes = 0;
  bool stop = 0;
  cin >> s;
  while (!stop) {
    stop = 1;
    int i = 0;
    int n = s.length();
    while (i < n - 1) {
      if (s[i] != s[i + 1]) {
        no_cubes += 2;
        s = s.substr(0, i) + s.substr(i + 2, n - i - 2);
        n -= 2;
        stop = 0;
      } else {
        ++i;
      }
    }
  }
  cout << no_cubes;
  return 0;
}
