给大家欣赏下石山代码
#include <algorithm>
#include <cctype>
#include <iostream>
using namespace std;
int main() {
int a, b, c;cin>>a>>b>>c;
string s;cin>>s;
auto make = [&](string s)->string{
int sz = s.size();
for(int k = 0;k < sz;++k){
if(s[k] != '-') continue;
int p = k;
if(p == 0 || p == s.size() - 1) continue;
string t = "";
char n = s[p-1], m = s[p+1];
if(n >= '0' && n <= '9' && m >= '0' && m <= '9' ||
n >= 'a' && n <= 'z' && m >= 'a' && m <= 'z'
){
if(m > n){
for(char i = s[p-1]+1;i < s[p+1];++i){
if(a == 1){
for(int j = 0;j < b;++j){
t += tolower(i);
}
}else if(a == 2){
for(int j = 0;j < b;++j){
t += toupper(i);
}
}else{
for(int j = 0;j < b;++j){
t += '*';
}
}
}
if(c - 1){
reverse(t.begin(), t.end());
}
s.erase(p, 1);
sz--;
s.insert(p, t);
sz += t.size();
k += t.size();
}
}
}
return s;
};
cout<<make(s);
}
// 64 位输出请用 printf("%lld")

京公网安备 11010502036488号