#include <bits/stdc++.h>
using namespace std;
int main(void) {
  string tumiki;
  int arr[1000] = {0};
  int flag = 1, num;
  cin >> tumiki;
  size_t size = tumiki.length();
  while (flag) {
    flag = 0;
    for (int i = 0; i < size - 1; i++) {
      if (tumiki[i] != tumiki[i + 1]) {
        for (int j = i; j < size - 2; j++) {
          tumiki[j] = tumiki[j + 2];
        }
        flag = 1;
        break;
      }
    }
    if (flag == 1) num += 2;
  }
  cout << num << endl;
  return 0;
}
