题解 | #牛牛的替换#
牛牛的替换
http://www.nowcoder.com/practice/f2a107dbb99243798d3048a672e8f747
#include<stdio.h>
int main(){
int n,i=0;
char a,b,c,d;
scanf("%d %c %c %c %c",&n,&a,&b,&c,&d);
char s[100]={'0'};
for(i=0;i<=n;i++){
scanf(" %c",&s[i]);//%c前面有个空格用于吸收回车
if(s[i]==a){
s[i]=b;
}else if(s[i]==c){
s[i]=d;
}
}
for(i=1;i<=n;i++){
printf("%c",s[i]);
}
return 0;
}