fork download
  1. #include <algorithm>
  2. #include <iterator>
  3. #include <iostream>
  4. #include <string>
  5. #include <vector>
  6. using namespace std;
  7.  
  8. int main() {
  9. istream_iterator<string> words { cin }, eof;
  10. vector<string> v(words, eof);
  11. sort(v.begin(), v.end());
  12. copy(v.begin(), v.end(), ostream_iterator<string>(cout, "\n"));
  13. }
Success #stdin #stdout 0s 4468KB
stdin
Steinbeck
Hemingway
Fitzgerald
stdout
Fitzgerald
Hemingway
Steinbeck