data structures using if(str[ ]=='\ 'copy_loop=knew_text[ntext[copy_loop] ++copy_loop++ ++new_str[ ]='\ 'printf("\ the new string is ")puts(new_str)getch()return output enter the main text hellohow are youenter the string to be deleted how are youthe new string is hello replacing pattern with another pattern in string the replacement operation is used to replace the pattern by another pattern this is done by writing replace(textpattern pattern for example("aaabbbccc""bbb"" "aaaxccc ("aaabbbccc"" ""yyy")aaabbbcc step [initializeset pos index(textp step set text delete(textposlength( )step insert(textposp step exit figure algorithm to replace pattern with another pattern in the text in the second examplethere is no change as does not appear in the text figure shows an algorithm to replace pattern with another pattern in the text the algorithm is very simplewhere we first find the position posat which the pattern occurs in the textthen delete the existing pattern from that position and insert new pattern there programming example write program to replace pattern with another pattern in the text #include #include main(char str[ ]pat[ ]new_str[ ]rep_pat[ ]int = = kn= copy_loop= rep_index= clrscr()printf("\ enter the string ")gets(str)printf("\ enter the pattern to be replaced")gets(pat)printf("\ enter the replacing pattern")gets(rep_pat)while(str[ ]!='\ ' = , =iwhile(str[ ]==pat[ &pat[ ]!='\ '