fork download
  1. #include <iostream>
  2. #include <iterator>
  3. #include <string>
  4. #include <vector>
  5.  
  6. template <typename It>
  7. bool has_vowel(It begin, It end)
  8. {
  9. while (begin!=end)
  10. {
  11. char lower = std::tolower(static_cast<unsigned char>(*begin));
  12.  
  13. if (lower == 'a' || lower == 'e' ||
  14. lower == 'i' || lower == 'o' || lower == 'u')
  15. return true;
  16.  
  17. ++begin;
  18. }
  19. return false;
  20. }
  21.  
  22. int main()
  23. {
  24. std::istream_iterator<std::string> f(std::cin), l;
  25.  
  26. for (auto& s : std::vector<std::string>(f, l))
  27. {
  28. if (!has_vowel(s.begin(), s.end()))
  29. std::cout << s << " ";
  30. }
  31. }
  32.  
Success #stdin #stdout 0s 3036KB
stdin
my friends klmr and family
stdout
my klmr