#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  char left, right;
  int left_index = 0, right_index = 1;
  int count = 0;
  cin >> S;
  while (right_index < S.size()) {
    if (S[left_index] != S[right_index]) {
      count++;
      if (left_index == 0)
        S = S.substr(right_index + 1);
      else {
        if (right_index + 1 < S.size()) {
          S = S.substr(0, left_index) + S.substr(right_index + 1);
        } else
          break;
      }
      left_index = 0;
      right_index = 1;
    } else {
      left_index++;
      right_index++;
    }
  }
  cout << count * 2 << endl;
  return 0;
}
