题解 | #牛牛的替换#
牛牛的替换
http://www.nowcoder.com/practice/f2a107dbb99243798d3048a672e8f747
int main() {
int n;
char a1, a2, a3, a4;
scanf("%d %c %c %c %c\n", &n, &a1, &a2, &a3, &a4);
char s[n];
for (int i = 0; i < n; i++) {
scanf("%c", &s[i]);
}
for (int i = 0; i < n; i++) {
if (s[i] == a1) s[i] = a2;
if (s[i] == a3) s[i] = a4;
printf("%c", s[i]);
}
return 0;
}