fork(1) download
  1. #include <iostream>
  2. #include <iterator>
  3. #include<algorithm>
  4. #include <vector>
  5.  
  6.  
  7. int main() {
  8.  
  9. std::vector<std::string> words;
  10. std::string word1,word2;
  11. size_t i;
  12. std::copy(std::istream_iterator<std::string> (std::cin),
  13. std::istream_iterator<std::string>(),
  14. std::back_inserter(words));
  15.  
  16. word1=words[0];
  17.  
  18. for(i=1; i<words.size();i++)
  19. {
  20. word2=words[i];
  21. sort(word2.begin(), word2.end());
  22. if(word2!=word1)
  23. break;
  24. }
  25.  
  26. if(i==words.size())
  27. std::cout<<"All Anagrams !";
  28.  
  29.  
  30.  
  31.  
  32. }
Success #stdin #stdout 0s 3440KB
stdin
abc bca cba
stdout
All Anagrams !