Run ID:3607
提交时间:2024-06-21 20:59:54
# include<iostream> # include<algorithm> using namespace std; string s; int p1,p2,p3;//p1大小写*号,p2重复数量,p3正序/逆序 void fun(int p1,int p2,int p3){ int pos=s.find("-"); while(pos!=-1){ int temp_pos=pos; string temp_s;// if(s[temp_pos]=='-'){ int num=s[temp_pos+1]-s[temp_pos-1]-1;//间隔字符数量 if(num<=0) {pos=s.find("-",pos+1);continue;}//如果后字符<=前字符 if(p1==1){ for(int j=0;j<num;j++) for(int i=1;i<=p2;i++) temp_s=temp_s+(char)(s[temp_pos-1]+j+1); } else if(p1==2){ for(int j=0;j<num;j++) for(int i=1;i<=p2;i++) temp_s=temp_s+(char)(s[temp_pos-1]+j+1-32); } else if(p1==3){ for(int j=0;j<num;j++) for(int i=1;i<=p2;i++) temp_s=temp_s+'*'; } if(p3==2) reverse(temp_s.begin(),temp_s.end()); s.replace(temp_pos,1,temp_s); //cout<<s<<endl; } //cout<<pos<<endl; pos=s.find("-",pos+1); } } int main(){ cin>>p1>>p2>>p3; cin>>s; fun(p1,p2,p3); cout<<s<<endl; return 0; }