#include <bits/stdc++.h>
using namespace std;
int main(void) {
  string S;
  cin >> S;
  int flag = 0, cz = 0, co = 0, count = 0;
  for (int i = 0; i < S.length(); i++) {
    if (S[i] == '0') {
      flag = 1;
      cz++;
    } else if (S[i] == '1' && flag == 1) {
      flag = 1;
      co++;
    } else {
      flag = 0;
      if (co > 0 && cz > 0) {
        count += min(co, cz) * 2;
      }
      co = 0;
      cz = 0;
    }
  }
  if (co > 0 && cz > 0) {
    count += min(co, cz) * 2;
  }
  cout << count;
  return 0;
}
