fork(2) download
  1. #include <iostream>
  2. #include <string>
  3. #include <algorithm>
  4. using namespace std;
  5.  
  6. int main() {
  7. string a, b, c;
  8. cin >> a >> b >> c;
  9. if (a > b) swap(a, b);
  10. if (a > c) swap(a, c);
  11. if (b > c) swap(b, c);
  12. cout << a << '\n' << b << '\n' << c;
  13. }
Success #stdin #stdout 0s 4500KB
stdin
Steinbeck
Hemingway
Fitzgerald
stdout
Fitzgerald
Hemingway
Steinbeck