Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- #define SEP " ;"
- #define NMAX 250
- using namespace std;
- char s[NMAX], x[NMAX];
- int main() {
- cin.getline(s, NMAX);
- cin >> x;
- char *p = strtok(s, SEP);
- int ok = 0;
- while (p) {
- if (!strcmp(p, x)) {
- p = strtok(NULL, SEP);
- cout << p << ' ';
- ok = 1;
- } else {
- p = strtok(NULL, SEP);
- }
- p = strtok(NULL, SEP);
- }
- if (!ok) {
- cout << "NU" << endl;
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment