fork download
  1. #include<stdio.h>
  2. #include<string.h>
  3. int main()
  4. {
  5. char a[30],fs[50]="",t[3],sd,cd,x[3],s[3],d[3],y[3];
  6. int i,j,p=0,q=0;
  7. printf("enter characters to be stuffed:");
  8. scanf("%s",a);
  9. printf("\nenter a character that represents starting delimiter:");
  10. scanf("%c",&sd);
  11. printf("\n enter a character that represents ending delimiter:");
  12. scanf("%c",&cd);
  13. x[0]=s[0]=s[1]=sd;
  14. x[1]=s[2]='\0';
  15. y[0]=d[0]=d[1]=cd;
  16. d[2]=y[1]='\0';
  17. strcat(fs,x);
  18. for(i=0;i<strlen(a);i++)
  19. {
  20. t[0]=a[i];
  21. t[1]='\0';
  22. if(t[0]==sd)
  23. strcat(fs,s);
  24. else if(t[0]==cd)
  25. strcat(fs,d);
  26. else
  27. strcat(fs,t);
  28. }
  29. strcat(fs,y);
  30. printf("\n after stuffing :%s",fs);
  31. return(0);
  32. }
  33.  
Success #stdin #stdout 0s 5312KB
stdin
Standard input is empty
stdout
enter characters to be stuffed:
enter a character that represents starting delimiter:
 enter a character that represents ending delimiter:
 after stuffing :ɯ�D�