# 【noip模拟赛1】古韵之同心锁

——秦观《鹊桥仙》

## 输入样例 1

MEIYOUwsshujuBYhh4742
14 1 1

## 输出样例 1

mmeeiiyyoouuWWSSSSHHUUJJUUbbyyHHHH44774422IImmmmoorrttaa11

## 输入样例 2

oiBYhh4742MEIYOU1013hh4742wsshujuBYhh4742
34 2 0

## 输出样例 2

oiMEIYOUhh4742hh4742wsshuju

## 输入样例 3

ipkepk
5 3 3

## 输出样例 3

iiiippppkkkkppppkkkkeeee

# 题解：

## AC Code

//
//  main.cpp
//
//
//  Created by Edwin on 2019/3/8.
//
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define INF 0x3f3f3f3f
#define eps 1e-8
#define PI acos(-1.0)
#define mst(a,b) memset(a,b,sizeof(a))
#define FF(i,a) for(int i=0;i<a;++i)
#define FORD(i,a,b) for(int i=a;i>=b;--i)
#define FOR(i,a,b) for(int i=a;i<=b;++i)
#define sc(t) scanf("%d",&(t))
#define sc2(t,x) scanf("%d%d",&(t),&(x))
#define pr(t) printf("%d\n",(t))
#define pb push_back
#define quickcin ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define lson rt<<1
#define rson rt<<1|1
#define delf (l+r)>>1
#define lowbit(x) (x&-x)
const int maxn=10000+10;
using namespace std;
int main(){
string str;
getline(cin,str);
int m,n,p;
scanf("%d%d%d",&m,&n,&p);
string ans,a,b;
a.assign(str,0,m-1);
b.assign(str,m-1,string::npos);
if(n==1){
ans=str;
for(int i=0;i<ans.length();++i){
if(ans[i] >= 'a' && ans[i] <= 'z'){
ans[i]-=32;
}
else if(ans[i] >= 'A' && ans[i] <= 'Z'){
ans[i]+=32;
}
}
ans+="Immorta1";
}
else if(n==2){
ans=a;
int position=0;
while((position=ans.find(b,position))!=string::npos){
ans.erase(position,b.length());
position++;
}
position=0;
while((position=ans.find("1013",position))!=string::npos){
ans=ans.replace(position,4,"hh4742");
position++;
}
}
else{
ans=a;
ans.insert(abs(n-m)-1,b);
}
for(int i=0;i<ans.length();++i){
for(int j=0;j<=p;++j){
printf("%c",ans[i]);
}
}
printf("\n");
return 0;
}


0 评论