Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma warning(disable: 4996)
- #include <iostream>
- #include <vector>
- #include <string>
- #include <iomanip>
- #include <cmath>
- #include <utility>
- #include <algorithm>
- #include <unordered_set>
- #include <set>
- #include <stdio.h>
- #include <map>
- #include <deque>
- #include <list>
- #include <stack>
- #include <numeric>
- #include <functional>
- using namespace std;
- int main() {
- freopen("input.txt", "r", stdin);
- freopen("output.txt", "w", stdout);
- string command;
- string line;
- list<string> lines;
- cin >> command;
- while (getline(cin, line))
- lines.push_back(line);
- lines.sort();
- if (command == "ASCENDING") {
- for (auto x : lines)
- cout << x << endl;
- } else {
- lines.reverse();
- for (auto x : lines)
- cout << x << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement