fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <sstream>
  4. #include <algorithm>
  5. #include <cctype>
  6.  
  7. int main()
  8. {
  9. std::string line;
  10. while (std::getline(std::cin, line))
  11. {
  12. line.erase(std::remove_if(line.begin(), line.end(),
  13. [](char ch) { return !std::isdigit(ch) && !std::isspace(ch) && ch != '.'; }), line.end());
  14. std::istringstream strm(line);
  15. double oneValue;
  16. while (strm >> oneValue)
  17. std::cout << oneValue << " ";
  18. }
  19. }
Success #stdin #stdout 0.01s 5540KB
stdin
dsfj  kdf     87  98.5 4vb
jfkd 9            jfkds000    94.3hjf
       98.4    jd84.    kfd
stdout
87 98.5 4 9 0 94.3 98.4 84