#include<bits/stdc++.h>
using namespace std;
int p1, p2, p3;
string s;
bool judge_char(char x,char y)
{
if(x>='a'&&x<='z'&&y>='a'&&y<='z')
return 1;
return 0;
}
bool judge_int(char x,char y)
{
if(x>='0'&&x<='9'&&y>='0'&&y<='9')
return 1;
return 0;
}
int main()
{
cin>>p1>>p2>>p3;
cin.ignore();
getline(cin,s);
for(int i=1; i<s.size()-1; i++)
{
if(s[i]=='-'&&(judge_char(s[i-1],s[i+1])||judge_int(s[i-1],s[i+1])))
{
if(s[i-1]>=s[i+1])
continue;
else if(s[i-1]==s[i+1]-1)
s.erase(i,1);
else
{
string s1="";
if(p1==1)
{
for(char x=s[i-1]+1;x<s[i+1];x++)
for(int j=0;j<p2;j++)
s1+=x;
}
else if(p1==2)
{
if(judge_char(s[i-1],s[i+1]))
for(char x=s[i-1]+1;x<s[i+1];x++)
for(int j=0;j<p2;j++)
s1+=x-32;
else
for(char x=s[i-1]+1;x<s[i+1];x++)
for(int j=0;j<p2;j++)
s1+=x;
}
else if(p1==3)
{
for(char x=s[i-1]+1;x<s[i+1];x++)
for(int j=0;j<p2;j++)
s1+='*';
}
if(p3==2)
reverse(s1.begin(),s1.end());
s.erase(i,1);
s.insert(i,s1);
i+=s1.size();
}
}
}
cout<<s;
}
标签:p2,p1,int,NC16644,char,牛客,&&,字符串
From: https://www.cnblogs.com/jinshuli/p/18622413