#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using ii = pair<int, int>;
using vii = vector<ii>;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  int n = s.size(), a = 0, b = 0;
  for (int i = 0; i < n; ++i) {
    if (s[i] == '0')
      a++;
    else
      b++;
  }
  if (a == 0 || b == 0)
    cout << 0;
  else
    cout << n;
}
