fork(1) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. int t;
  6. cin >> t;
  7. while(t--)
  8. {
  9. string s;
  10. cin >> s;
  11. int n = s.size();
  12. int r=0,c=0;
  13. for(int i=n-1;i>=0;i--)
  14. {
  15. if((s[i]-'0') > 0 )
  16. {
  17. r = i;
  18. }
  19. }
  20. for(int i=0;i<r;i++)
  21. {
  22. if(s[i]=='0')
  23. {
  24. c++;
  25. }
  26. }
  27. int m = n-(n-1)+c ;
  28. cout << m << endl;
  29. }
  30. return 0;
  31. }
Success #stdin #stdout 0.01s 5316KB
stdin
4
666
13700
102030
7
stdout
1
1
1
1