Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- int main()
- {
- char s[1000001];
- cin.getline(s,1000);
- int n,x,L;
- cin>>n;
- while(n--)
- {
- cin>>x;
- int j;
- L=strlen(s);
- if(x%2)
- {
- j=x;
- for(int i=L;i<L+x;++i)
- s[i]=s[--j];
- s[L+x]=0;
- }
- else
- {
- j=0;
- for(int i=L;i<L+x;++i)
- s[i]=s[j++];
- s[L+x]=0;
- }
- }
- cout<<s;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement