提交时间:2021-12-13 13:50:01
运行 ID: 35167
#include<bits/stdc++.h> using namespace std; int main() { int p1,p2,p3; cin>>p1>>p2>>p3; string s,ans=""; cin>>s; for(int i=0; i<s.length(); i++) { if(s[i]!='-') ans+=s[i]; else { if(i==0||i==s.length()-1) ans+=s[i]; else if(s[i-1]=='-'||s[i+1]=='-') ans+=s[i]; else if(s[i-1]==s[i+1]) ans+=s[i]; else if(s[i-1]>s[i+1]) ans+=s[i]; else if(isdigit(s[i-1])&&!isdigit(s[i+1])) ans+=s[i]; else if(islower(s[i-1])&&!islower(s[i+1])) ans+=s[i]; else if(isupper(s[i-1])&&!isupper(s[i+1])) ans+=s[i]; else { if(p3==1) for(char j=s[i-1]+1; j<s[i+1]; j++) { for(int k=1; k<=p2; k++) { if(p1==1) ans+=tolower(j); else if(p1==2) ans+=toupper(j); else ans+='*'; } } else for(char j=s[i+1]-1; j>s[i-1]; j--) { for(int k=1; k<=p2; k++) { if(p1==1) ans+=tolower(j); else if(p1==2) ans+=toupper(j); else ans+='*'; } } } } } cout<<ans<<endl; return 0; }