#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  int N = S.size();
  int ans = 0;
  int before_ans = 0;
  int count = 0;
  int while_count = 0;
  while (true) {
    if (N == 1) goto END;
    for (int fst = 0; fst < N - 1; ++fst) {
      before_ans = ans;
      count = 0;
      if (S[fst] == '2') continue;
      if (S[fst] == '1') {
        int scd = fst + 1;
        for (int j = fst + 1; j < N; ++j) {
          if (S[j] != '2') {
            scd = j;
            break;
          }
        }
        if (S[scd] == '0') {
          S[fst] = '2';
          S[scd] = '2';
          ans += 2;
          count++;
        }
      }
      if (S[fst] == '0') {
        int scd = fst + 1;
        for (int j = fst + 1; j < N; ++j) {
          if (S[j] != '2') {
            scd = j;
            break;
          }
        }
        if (S[scd] == '1') {
          S[fst] = '2';
          S[scd] = '2';
          ans += 2;
          count++;
        }
      }
      if ((while_count >= 10000 / 2) && (before_ans == ans)) goto END;
      while_count++;
    }
  }
END:
  cout << ans << endl;
  return 0;
}
