提交时间:2023-08-22 21:06:11

运行 ID: 99481

#include<iostream> #include<string> #include<cstring> using namespace std; string s; int p1,p2,p3; int main() { cin>>p1>>p2>>p3>>s; int n=s.size(),i{}; while(s[i]=='-') cout<<'-', i++; while(i!=n) { char c=s[i]; if(c!='-') cout<<c; else if(i!=0) { c=s[i-1]; char c2=s[i+1]; if(c>=c2 || isdigit(c)&&isalpha(c2) || (c=='-')||(c2=='-')) cout<<'-'; else if(!(c==c2 || c+1==c2)) { if(p3==1) { for(char j=c+1;j<c2;j++) for(int k=1;k<=p2;k++) if(p1==3) cout<<'*'; else if(isdigit(c2)) cout<<j; else { char ch=j; if(p1==2) ch=ch-'a'+'A'; cout<<ch; } } else { for(char j=c2-1;j>c;j--) for(int k=1;k<=p2;k++) if(p1==3) cout<<'*'; else if(isdigit(c2)) cout<<j; else { char ch=j; if(p1==2) ch=ch-'a'+'A'; cout<<ch; } } } } ++i; } return 0; }