Untitled
unknown
plain_text
a year ago
1.3 kB
5
Indexable
#include<stdio.h> #include<conio.h> #include<string.h> #include<process.h> int main() { int i=0,j=0,n,pos; char a[20],b[50],ch; printf("Enter string\n:"); scanf("%s",&a); n=strlen(a); printf("enter position \n"); scanf("%d",& pos); if(pos>n) { printf("invalid position,enter again:"); scanf("%d",&pos); ch=getch(); b[0]='d'; b[1]='i'; b[2]='e'; b[3]='3'; b[4]='t'; b[5]='x'; j=6; while(i<n) { if(i==pos-1) { b[j]='d'; b[j+1]='i'; b[j+2]='e'; b[j+3]='ch'; b[j+4]='d'; b[j+5]='i'; b[j+6]='e'; j=j+7; } if(a[i]=='a'&&a[i+1]=='i'&&a[i+2]=='e') { b[j]='d'; b[j+1]='i'; b[j+2]='e'; j=j+3; } b[j]=a[i]; i++; j++; } b[j]='d'; b[j+1]='i'; b[j+2]='e'; b[j+3]='e'; b[j+4]='t'; b[j+5]='x'; b[j+6]='10'; printf("\n frame after stuffing:\n"); printf("%s",b); getch(); } }
Editor is loading...
Leave a Comment