Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- //sa se determine cel mai lung prefix comun
- //cel mai lung sufix comun
- int main()
- {
- char S[256];
- char P[256];
- int i;
- cin>>S;
- strcpy(P,S);
- //prefixe
- for(i=strlen(S)-1;i>=0;i--){
- cout<<S<<'\n';
- S[i]=0;
- }
- //sufixe
- for(i=0;i<strlen(P);i++)
- cout<<P+i<<'\n';
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement