Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- #define NMAX 22
- char s[NMAX][NMAX];
- int main() {
- int n;
- cin >> n;
- for (int i = 1; i <= n; i++) {
- cin >> s[i];
- }
- int prefLen = strlen(s[n]);
- bool e = false;
- for (int i = 1; i < n; i++) {
- if (!strncmp(s[i], s[n], prefLen)) {
- e = true;
- cout << s[i] << ' ';
- }
- }
- if (!e) {
- cout << "nu exista" << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement