#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  long long prev = 0, ans = 0;
  stack<long long> st;
  if (s[0] == '1') prev = 1;
  for (int i = 0; i < s.size() - 1; i++) {
    if ((s[i + 1] == '0' && prev == 1) || (s[i + 1] == '1' && prev == 0)) {
      ans += 2;
      if (!st.empty()) {
        prev = st.top();
        st.pop();
      } else {
        if (i + 2 < s.size() && s[i + 2] == '0') {
          prev = 0;
        } else if (i + 2 < s.size() && s[i + 2] == '1') {
          prev = 1;
        }
      }
    } else {
      st.push(prev);
      if (s[i + 1] == '0')
        prev = 0;
      else
        prev = 1;
    }
  }
  cout << ans << endl;
  return 0;
}
