1 solutions
-
0
C :
#include<stdio.h> #include<string.h> #include<ctype.h> char s[1000],a[100],b[100],t[100],f[2]; int main(){ gets(s); gets(a); gets(b); int i,j,n = strlen(s),m = strlen(a); for(i=0;i<n;){ memset(t,0,sizeof(t)); for(j=i;j<i+m && j<n;j++){ f[0] = s[j]; f[1] = '\0'; strcat(t,f); } if(strcmp(t,a)==0){ printf("%s",b); i = j; }else{ printf("%c",s[i]); i++; } } return 0; }
Python :
str1=input() str2=input() str3=input() x=str1.replace(str2,str3) print(x)
- 1
Information
- ID
- 10802
- Time
- 1000ms
- Memory
- 16MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By