Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string.h>
- #include <fstream>
- using namespace std;
- char s[256],a[50][50],*p;
- int n;
- ifstream f("text.in")
- ofstream g("rime.out")
- int main()
- {
- f.getline(s,256);
- p=strtok(s," ");
- n=0;
- while(p!=NULL)
- {
- strcpy(a[n],p);
- n++;
- p=strtok(NULL," ");
- }
- for(int i=0;i<n-1;i++)
- for(int j=i+1;j<n;j++)
- if(a[i][strlen(a[i])-1]==a[j][strlen(a[j])-1] && a[i][strlen(a[i])-2]==a[j][strlen(a[j])-2])
- g<<a[i]<<" "<<a[j]<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement