int main()
{
	int i;
	char paragraph[50];             //paragraph string
	int sizeofpara;                 //size of paragraph
	char wrongword[50];             //word going to be replaced
	int wsize;                      //size of the wrong word
	char correctword[50];           //replacing word
	int csize;                      //size of the correct word
	int wrongwordposition;          //position where wrong word is located in the paragraph

	printf("Enter the paragraph :\n");
	readline(paragraph);                            //paragraph input
	sizeofpara = strlen(paragraph);
M:
	printf("Enter the word to be removed :\n");
	readline(wrongword);                            //wrongword input
	wsize = strlen(wrongword);

	wrongwordposition = findword(paragraph , sizeofpara , wrongword , wsize);   //finding wrong word
	if (wrongwordposition > sizeofpara) {
	    goto M;                                     //since word is not found requesting to input again
	} else {
        removeword(paragraph , sizeofpara , wrongwordposition , wsize);             //removing wrong word
	}
	printf("Enter the word you want to replace it with :\n");
    readline(correctword);                          //correct word input
    csize = strlen(correctword);

    insertword(paragraph , sizeofpara - wsize , wrongwordposition , correctword , csize);   //replacing with correct word

	return 0;
}
Exemple #2
0
int main()
{
trie *root=createNode();
char str[100];
int total=0;
s(total);
	while(total--)
	{
		scanf("%s",str);
		addword(root,str);
	}

printf("Enter word to search \n");
ss(str);
printf("Word : %s Instances : %d\n ",str,countwords(root,str));
printf("ENter word to remove\t");
ss(str);
removeword(root,str);

printf("Enter word to search \n");
ss(str);
printf("Word : %s Instances : %d\n ",str,countwords(root,str));



return 0;

}