#include <bits/stdc++.h>
using namespace std;
int main(void) {
  string t, s;
  int k = 0;
  cin >> s;
  while (1) {
    int i = 0;
    t = s[0];
    for (auto x : s) {
      if (t[0] != x) {
        s.erase(s.begin() + i - 1, s.begin() + i + 1);
        k++;
        break;
      }
      t = s[i];
      i++;
    }
    if (s.length() == i) break;
  }
  cout << k * 2 << endl;
}
