#include<stdio.h>
int replace(char *s,char *s1,char *s2);
int main()
{
char s[20]="ABCBA",s1[10]="AC",s2[10]="ac";int k;
printf("\n\ns=");puts(s);
printf("\ns1="); puts(s1);
printf("\ns2="); puts(s2);
replace (s,s1,s2);
printf("\nAfter s=");
puts(s);
}
replace(char *s,char *s1,char *s2)
{
char *p;
for(; *s;s++)
{ p=s1;
while(*p && *p!=*s ) p++;
if (*p) *s=*(s2+(p-s1));
}
}