#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = -100100100;
int main() {
  string s;
  cin >> s;
  vector<int> d(s.size());
  for (int i = 0; i < (s.size()); ++i) d[i] = int(s[i]) == 49 ? 1 : 0;
  int n = s.size();
  ll ans = 0;
  bool cnt = true;
  while (cnt) {
    vector<int> d1;
    bool skip = false;
    int n = d.size();
    for (int i = 0; i < (n - 1); ++i) {
      if (skip) {
        skip = false;
        continue;
      }
      if (d[i] == 0 && d[i + 1] == 1) {
        ans += 2;
        skip = true;
        continue;
      } else if (d[i] == 1 && d[i + 1] == 0) {
        ans += 2;
        skip = true;
        continue;
      }
      d1.push_back(d[i]);
    }
    if (d1.size() == d.size()) {
      cnt = false;
    }
    d = d1;
  }
  cout << ans << endl;
  return 0;
}
