http://ac.jobdu.com/problem.php?pid=1177
#include<stdio.h>
#include<string.h>int main()
{
int i,j,n,start,len;
char str[105],s[105],temp;
while(scanf("%s",str)!=EOF){
scanf("%d",&n);
while(n--){
scanf("%s",s);
start=s[1]-'0'; len=s[2]-'0';
if(s[0]=='0'){
for(i=start,j=start+len-1;i<j;i++,j--){ // 倒置范围没有处理好,wa了2次。。。
temp=str[i];
str[i]=str[j];
str[j]=temp;
}
}else if(s[0]=='1'){
for(i=start;i<start+len;i++){
str[i]=s[i-start+3]; // 注意下标。。。
}
}
printf("%s\n",str);
}
}
return 0;
}