#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, left = "", right = "";
  cin >> s;
  int era = 0;
  bool check = true;
  while (check) {
    check = false;
    for (int i = 1; i < s.size(); i++) {
      if (s[i] != s[i - 1]) {
        era++;
        check = true;
        left = s.substr(0, i - 1);
        right = s.substr(i + 1, s.size() - i + 1);
        s = left + right;
        break;
      }
    }
  }
  cout << era * 2 << endl;
}
