#include <iostream>
#include <cstring>
using namespace std;
int main()
{
char a[31],b[31];
int gasit=0;
cin>>a>>b;
for(int i=strlen(a)-1;i>0;i--)
if(strstr(b,a+i)==b) //daca sufixul a+i e la inceputul lui b
{
cout<<a+i<<" ";//afisez sufixul
gasit=1;
}
if(!gasit) cout<<"NU EXISTA";
return 0;
}
|