#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
  string s;
  cin >> s;
  int z = 0, one = 0;
  if (s[0] == '0')
    z++;
  else
    one++;
  int ans = 0;
  for (int i = 1; i < s.size(); i++) {
    if (s[i] == '0' && s[i - 1] == '1') {
      if (z >= one) {
        ans += 2 * one;
        one = 0;
        z -= one;
      } else {
        ans += 2 * z;
        one = 0;
        z = 0;
      }
    }
    if (s[i] == '0')
      z++;
    else
      one++;
  }
  if (s[s.size() - 1] == '0')
    z++;
  else
    one++;
  if (z >= one) {
    ans += 2 * one;
    one = 0;
    z -= one;
  } else if (z < one) {
    ans += 2 * z;
    one = 0;
  }
  cout << ans << endl;
  return 0;
}
