#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int counta = 0, countb = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s.at(i) == 'O') {
      counta++;
    }
  }
  for (int i = 0; i < s.size(); i++) {
    if (s.at(i) == '1') {
      countb++;
    }
  }
  cout << min(counta, countb) * 2 << endl;
}
