#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  int zer = 0, one = 0, count = 0;
  for (int i = 0; i < S.size(); i++) {
    if (one == 0 && S.at(i) == '0') {
      zer++;
    } else if (zer > 0 && S.at(i) == '1') {
      one++;
    } else if (one > 0 && S.at(i) == '0') {
      if (zer > one) {
        count += one;
        zer = zer - one + 1;
        one = 0;
      } else {
        count += zer;
        zer = 1;
        one = 0;
      }
    }
    if (i == S.size() - 1 && S.at(i) == '1') {
      one++;
      count += min(zer, one);
    }
  }
  cout << count * 2 << endl;
}
