#include<iostream>
using namespace std;
void print_word(char *sen,char*word)
{
    int i,j;
    char chs,*se,*w=word,*s=sen;
    while(*s!='\0')
    {for(i=0;s[i]!='\0'&&s[i]!='.';i++);
    se=s;
    while(*se!='\0')
    {while(*se==' ')se++;
    for(j=0;se[j]!=' '&&s[j]!='.';j++);
    chs=se[j];s[j]='.';
    if(j==strlen(w))
    {if(strcmp(se,w)==0)
    printf("%s\n",se);
    se[j]=chs;
    }
    se=&se[j];
    }
    s=&s[i];
    }
}
void main()
{
    char sen[100],word[4];
    printf("enter the sentence:\n");
    gets(sen);
    printf("enter the word:\n");
    gets(word);
    print_word(sen,word);
}