static int countDigitsInString(S s) { int n = 0; for i over s: if (isDigit(s.charAt(i))) ++n; ret n; }