fork download
  1. #include <algorithm>
  2. #include <iostream>
  3. #include <iterator>
  4. #include <sstream>
  5. #include <string>
  6.  
  7. int main()
  8. {
  9. std::string sentence;
  10. std::getline(std::cin, sentence);
  11. {
  12. std::istringstream in(sentence);
  13. std::ostringstream out;
  14. std::vector<std::string> words{std::istream_iterator<std::string>(in),
  15. std::istream_iterator<std::string>() };
  16. std::rotate_copy(words.begin(), words.begin() + 1, words.end(),
  17. std::ostream_iterator<std::string>(out, " "));
  18. sentence = out.str();
  19. }
  20. std::cout << sentence;
  21. }
  22.  
Success #stdin #stdout 0s 3436KB
stdin
MAC101 is the class
stdout
is the class MAC101