Amonin

Untitled

Dec 14th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.93 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. using namespace std;
  5. int main() {
  6.     string request;
  7.     int colomn = 0;
  8.     getline(cin, request);
  9.     for (int i = 3; i < request.length(); ++i) {
  10.         colomn *= 10;
  11.         colomn += request[i] - '0';
  12.     }
  13.     if (request.find("-c") == request.npos) {
  14.         string s;
  15.         while (getline(cin, s)) {
  16.             cout << s << endl;
  17.         }
  18.     } else {
  19.         string s;
  20.         while (getline(cin, s)) {
  21.             vector<string> text;
  22.             while (s.find("\t") != s.npos) {
  23.                 string str_new = s.substr(0, s.find("\t"));
  24.                 text.push_back(str_new);
  25.                 s = s.substr(s.find("\t") + 1);
  26.             }
  27.             text.push_back(s);
  28.             if (text.size() >= colomn) {
  29.                 cout << text[colomn - 1] << endl;
  30.             } else {
  31.                 cout << endl;
  32.             }
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment