fork(6) download
  1. #include <iostream>
  2. #include <vector>
  3. #include <string>
  4. #include <algorithm>
  5. using namespace std;
  6.  
  7. int main() {
  8.  
  9. vector <string> arr;
  10. string word;
  11. while (cin >> word) {
  12. if (word == "stop") break;
  13. arr.push_back(word);
  14. }
  15.  
  16. sort(arr.begin(), arr.end());
  17.  
  18. for (int i = 0; i < arr.size(); i++) {
  19. cout << arr[i] << endl;
  20. }
  21.  
  22. return 0;
  23. }
Success #stdin #stdout 0s 4360KB
stdin
home aisle drugs stop
stdout
aisle
drugs
home