Amonin

Untitled

Dec 14th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <string>
  4. #include <vector>
  5. using namespace std;
  6. int main() {
  7.     string request;
  8.     getline(cin, request);
  9.     vector<string> text;
  10.     string str;
  11.     while (getline(cin, str)) {
  12.         text.push_back(str);
  13.     }
  14.     if (request.find("--tac") != request.npos) {
  15.         reverse(text.begin(), text.end());
  16.     }
  17.     if (request.find("--rev") != request.npos) {
  18.         for (string& s : text) {
  19.             reverse(s.begin(), s.end());
  20.         }
  21.     }
  22.     for (string s : text) {
  23.         cout << s << endl;
  24.     }
  25.     system("pause");
  26. }
Advertisement
Add Comment
Please, Sign In to add comment