data structures using if( ==poswhile(str[ !'\ 'ins_text[jstr[ ] ++ ++else ins_text[jtext[ ] ++ ++ins_text[ '\ 'printf("\ the new string is ")puts(ins_text)getch()return output enter the main text newsman enter the string to be inserted paper enter the position at which the string has to be inserted the new string isnewspaperman pattern matching this operation returns the position in the string where the string pattern first occurs for exampleindex("welcome to the world of programming""world" howeverif the pattern does not exist in the stringthe index function returns figure shows an algorithm to find the index of the first occurrence of string within given text step [initializeset iand max length(text)-length(str)+ step repeat steps to while max step repeat step for to length(strstep if str[ !text[ ]then goto step [end of inner loopstep set index goto step step set + [end of outer loopstep set index - step exit figure algorithm to find the index of the first occurrence of string within given text in this algorithmmax is initialized to length(textlength(str for exampleif text contains 'welcome to programmingand the string contains 'world'in the main textwe will look for at the most characters because after that there is no scope left for the string to be present in the text steps to are repeated until each and every character of the text has been checked for the occurrence of the string within it in the inner loop in step we check the characters of string