Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- void Prefix(char s[])
- {
- int n=strlen(s);
- for(int i=0;i<n;i++)
- {
- cout<<s<<"\n";
- strcpy(s+n-1-i,s+n-i);
- }
- }
- void Prefix2(char s[])
- {
- int n=strlen(s);
- for(int i=0;i<n;i++)
- {
- for(int j=0;j<n-i;j++)
- cout<<s[j];
- cout<<"\n";
- }
- }
- void Sufix(char s[])
- {
- int n=strlen(s);
- for(int i=0;i<n;i++)
- {
- cout<<s<<"\n";
- strcpy(s,s+1);
- }
- }
- int main()
- {
- char s[1001],t[1001];
- cin>>s;
- strcpy(t,s);
- Prefix(s);
- Sufix(t);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement