fork download
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. int main() {
  6. int t;
  7. cin >> t;
  8. while (t--) {
  9. string s;
  10. cin >> s;
  11.  
  12. // إيجاد أكبر رقم في السلسلة
  13. char maxDigit = '0';
  14. for(char c : s) {
  15. if(c > maxDigit) maxDigit = c;
  16. }
  17.  
  18. // عدد الحذف = طول الرقم - 1
  19. int removeCount = s.size() - 1;
  20. cout << removeCount << endl;
  21. }
  22. return 0;
  23. }
Success #stdin #stdout 0.01s 5292KB
stdin
4
666
13700
102030
7
stdout
2
4
5
0