fork(4) download
  1. #include <string>
  2. #include <algorithm>
  3. #include <iostream>
  4. #include <cctype>
  5.  
  6. unsigned countNumbers(const std::string s) {
  7. int (*isdigit)(int) = std::isdigit;
  8. return count_if(s.begin(), s.end(), isdigit);
  9. }
  10.  
  11. int main(){
  12. std::cout << countNumbers("1234abc251");
  13. }
Success #stdin #stdout 0s 2984KB
stdin
Standard input is empty
stdout
7