fork download
  1. #include <algorithm>
  2. #include <cctype>
  3. #include <iostream>
  4. #include <string>
  5. #include <vector>
  6.  
  7. using namespace std;
  8.  
  9. int main() {
  10. const vector<string> foo = { "Why"s, "do"s, "do"s, "we"s, "we"s, "here"s, "here?"s };
  11.  
  12. for(auto it = cbegin(foo); it != cend(foo); ++it) {
  13. if(none_of(next(it), cend(foo), [&](const auto& i) {
  14. const auto finish = mismatch(cbegin(*it), cend(*it), cbegin(i), cend(i));
  15. return (finish.first == cend(*it) || !isalnum(*finish.first)) && (finish.second == cend(i) || !isalnum(*finish.second));
  16. })) {
  17. cout << *it << ' ';
  18. }
  19. }
  20. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
Why do we here?