单点时限: 1.0 sec
内存限制: 256 MB
//********** Specification of replace **********
void replace(char s[], char x[], char y[]);
/* Precondition: s, x and y are three strings,
and s has enough memory to store modified string
Postcondition: replace all substring x with y in string s
*/
void replace(char s[], char x[], char y[]) { //TODO: your function definition
}
#include <stdio.h>
#define N 80
int main() {
char s[3 * N + 1], x[N + 1], y[N + 1];
scanf("%s%s%s", s, x, y);
replace(s, x, y);
printf("%s\n", s);
return 0;
}
iamstupid stupid clever
iamclever
The input consists of three strings $s,x,y$ ($1 \le |s|, |x|, |y| \le 80$), where $|s|$ is the length of $s$. All strings appearing in the input consist only of ascii lowercase letters.
$x$ will not overlap in $s$, but can repeat. It is guaranteed the answer $s’$ satisfies $1 \le |s’| \le 240$.