fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. long long a, b=0, c;
  6. cin >> a;
  7. while (c=a%10 && a>0){
  8. if (c<=1)
  9. b++;
  10. a=a/10 ; }
  11. cout << b;
  12.  
  13. return 0;
  14. }
Success #stdin #stdout 0s 4356KB
stdin
201234
stdout
4