#include <bits/stdc++.h> using namespace std; int p1,p2,p3; string str,Anstr; char Tochar(char sh){ if(p1==3){ return '*'; } return p1==1?tolower(sh):toupper(sh); } int main(int argc, char** argv) { cin>>p1>>p2>>p3<<str; char a[1000]; str=' '+str+' '; for(int i=1;i<str.size()-1;i++){ a[i]=str[i]; if(a[i]=='-'){ char s=a[i-1],t=a[i+1]; if(s<t && (islower(s)&&islower(t)) || (isdigit(s) && isdigit(t)) ){ if(p3==1){ for(int i=s+1;i<t-1;i++){ for(int j=0;j<p2;j++){ Anstr+=Tochar(i); } } }else{ for(int i=t-1;i>s+1;i--){ for(int j=0;j<p2;j++){ Anstr+=Tochar(i); } } } }else{ Anstr+='-'; } }else{ Anstr+=str[i]; } } cout<<Anstr<<endl; return 0; }
标签:p2,p1,return,int,char,sh,字符串,展开 From: https://www.cnblogs.com/fushuxuan/p/17578262.html