#include <bits/stdc++.h>
std::string S;
int count = 0;
int size = 0;
void delS(int a) {
  for (int i = a; i < size - 2; i++) {
    S[i] = S[i + 2];
  }
  count += 2;
}
int main() {
  std::cin >> S;
  size = S.size();
  for (int i = 0; i < size - 1; i++) {
    if (S[i] != S[i + 1]) {
      delS(i);
      i = -1;
    }
  }
  std::cout << count << std::endl;
  return 0;
}
