Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main() {
- int i;
- int x;
- int y;
- int tl;
- cin >> tl;
- string l[tl];
- for (i=0; i<=(tl-1); i++) {
- cin >> l[i];
- }
- int matriz[tl][tl];
- for (y=0; y<=(tl-1); y++) {
- for (x=0; x<=(tl-1); x++) {
- if(int(l[x].find (l[y]))!=l[x].npos) {
- matriz[x][y]=1;
- }
- }
- }
- for(y=0; y<=(tl-1); y++) {
- for (x=0; x<=(tl-1); x++) {
- if (x!=y && matriz[x][y]==1) {
- cout << l[y] << " " << l[x] << endl;
- }
- }
- }
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment