#include <bits/stdc++.h>
using namespace std;
char alphz[27] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
                  'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',
                  's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string s;
  cin >> s;
  vector<bool> vis(100004, false);
  int n = (int)s.size();
  int ans = 0;
  if (n == 1) return cout << 0 << '\n', 0;
  for (int i = 1; i < n; i++) {
    if (s[i] == '1' && s[i - 1] == 0) {
      ans++;
      vis[i] = 1;
      vis[i - 1] = 1;
    } else if (s[i] == '0' && s[i - 1] == '1') {
      ans++;
      vis[i] = 1;
      vis[i - 1] = 1;
    }
  }
  for (int i = 0; i < n - 1; i++) {
    if (!vis[i] && s[i] == '0') {
      for (int j = i + 1; j < n; j++) {
        if (!vis[j] && s[j] == '1') {
          ans++;
          vis[j] = 1;
          break;
        }
      }
    } else if (!vis[i] && s[i] == '1') {
      for (int j = i + 1; j < n; j++) {
        if (!vis[j] && s[i] == '0') {
          ans++;
          vis[j] = 1;
          break;
        }
      }
    }
    vis[i] = 1;
  }
  cout << ans * 2 << '\n';
  return 0;
}
