fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int t;
  6. cin >> t;
  7.  
  8. while (t--) {
  9. string s;
  10. cin >> s;
  11.  
  12. int x;
  13. for (int i = s.size() - 1; i >= 0; i--) {
  14. if (s[i] != '0') {
  15. x= i;
  16. break; }
  17. }
  18. int c = 1;
  19. for (int i = 0; i < x; i++) {
  20. if (s[i] == '0')c++;
  21. }
  22. cout << s.size() - c << '\n';
  23. }
  24. }
Success #stdin #stdout 0.01s 5292KB
stdin
4
666
13700
102030
7
stdout
2
4
3
0