提交时间:2023-08-22 11:22:23
运行 ID: 99166
#include <bits/stdc++.h> using namespace std; int p1,p2,p3; string solve(char a, char b){ string ans=""; if(a>=b) return "-"; else if('a'<=a&&a<='z'&&'a'<=b&&b<='z'){ if(p1 == 2) a -= 32,b -= 32; for(char i = a+1; i <= b-1; i++) for(int k = 1; k <= p2; k++) ans+=i; } else if('0'<=a&&a<='9'&&'0'<=b&&b<='9'){ for(char i=a+1;i<=b-1;i++) for(int k=1;k<=p2;k++) ans+=i; } else return "-"; if(p1==3){ string ans2; for(int i=ans.size()-1;i>=0;i--) ans2+='*'; return ans2; } if(p3 == 2){ string ans2; for(int i=ans.size()-1;i>=0;i--) ans2+=ans[i]; return ans2; } return ans; } signed main(){ string s; cin>>p1>>p2>>p3; cin>>s; cout<<s[0]; for(int i=1; i<s.length()-1;i++){ if(s[i] == '-') cout<<solve(s[i-1],s[i+1]); else cout<<s[i]; } cout<<s[s.length()-1]; return 0; }