Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <vector>
- using namespace std;
- int main() {
- string request;
- int colomn = 0;
- getline(cin, request);
- for (int i = 3; i < request.length(); ++i) {
- colomn *= 10;
- colomn += request[i] - '0';
- }
- if (request.find("-c") == request.npos) {
- string s;
- while (getline(cin, s)) {
- cout << s << endl;
- }
- } else {
- string s;
- while (getline(cin, s)) {
- vector<string> text;
- while (s.find("\t") != s.npos) {
- string str_new = s.substr(0, s.find("\t"));
- text.push_back(str_new);
- s = s.substr(s.find("\t") + 1);
- }
- text.push_back(s);
- if (text.size() >= colomn) {
- cout << text[colomn - 1] << endl;
- } else {
- cout << endl;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment