Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- char a[1000],b[100],c[100];
- int i,j,k=1,l,m;
- gets(a);
- //a='\0';
- char *pa=a,*temp,*z;
- gets(b);
- gets(c);
- int lb=strlen(b),la=strlen(a),lc=strlen(c);
- char *pb=b, *pc=c;
- for(i=0;i<la;i++){
- k=1;
- if((*pa)==(*pb)){
- for(j=0;j<lb;j++){
- if((*pa)!=(*pb)){
- k=0;
- pa-=j;
- pb-=j;
- break;
- }
- else{
- pa++;
- pb++;
- }
- }
- if(k && (lb>lc)){
- pa-=lb;
- pb-=lb;
- for(l=0;l<lc;l++){
- (*pa)=(*pc);
- pa++;
- pc++;
- }
- if(lb>lc){
- pc-=lc;
- int t=0;
- temp=pa+(lb-lc);
- while((*pa)!='\0'){
- (*pa)=(*temp);
- temp++;
- pa++;
- t++;
- }
- temp=0;
- pa-=t;
- }
- /*else if(lb<lc){
- temp=la+(lc-lb);
- while(x!=i+)
- }*/
- }
- else if(k && (lc>lb)){
- z=pa;
- pa+=(la-(i+j));
- temp=pa+(lc-lb);
- m=0;
- while((z)!=(pa)){
- (*temp)=(*pa);
- temp--;
- pa--;
- }
- pa-=lb;
- pb-=lb;
- for(l=0;l<lc;l++){
- (*pa)=(*pc);
- pa++;
- pc++;
- //m++;
- }
- //pa+=lc;
- }
- else if(k){
- pa-=lb;
- pb-=lb;
- for(l=0;l<lc;l++){
- (*pa)=(*pc);
- pa++;
- pc++;
- }
- pc-=lc;
- }
- }
- else{
- pa++;
- }
- }
- puts(a);
- }
Add Comment
Please, Sign In to add comment