3445. 字符串替换

单点时限: 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;
}

样例

Input
iamstupid stupid clever
Output
iamclever

提示

The input consists of three strings (), where is the length of . All strings appearing in the input consist only of ascii lowercase letters.

will not overlap in , but can repeat. It is guaranteed the answer satisfies .

309 人解决,436 人已尝试。

483 份提交通过,共有 2842 份提交。

3.1 EMB 奖励。

创建: 2 年,1 月前.

修改: 2 年,1 月前.

最后提交: 1 周,1 天前.

来源: 2017.11 程序设计基础月考

题目标签