Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string.h>
- using namespace std;
- int main()
- {
- char a[20], b[20], c[20]="";
- int n, m, i, j, k=0;
- cin.get(a,20);
- cin.get();
- cin.get(b, 20);
- n=strlen(a);
- m=strlen(b);
- i=n-1;
- j=m-1;
- while(a[i]==b[j])
- {
- c[k]=a[i];
- k++;
- i--;
- j--;
- }
- if(c[0]==NULL)
- cout<<"NU EXISTA";
- else
- for(i=k-1; i>=0; i--)
- cout<<c[i];
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement