#include <bits/stdc++.h>
using namespace std;
int main() {
  int count = 0;
  int length;
  string str;
  cin >> str;
  length = str.length();
  for (int i = 0; i < length; i++) {
    if (length > 1 && str[i] != str[i + 1]) {
      count = count + 2;
      for (int j = i; j < length; j++) {
        str[j] = str[j + 2];
      }
      i = 0;
      length = length - 2;
    }
  }
  cout << count << endl;
  return 0;
}
