program z16_67;
uses crt;
type word=array[1..100] of string;
var s,w:string;
a:word;
n,i,max,m:byte;
procedure init_word(s:string; var a:word; var n:byte);
var i:byte;
BEGIN
s:=s+' ';
n:=0;
while s<>'' do begin
while(s[1]=' ') and (s<>'') do delete(s,1,1);
if s<>'' then begin
n:=n+1;
i:=pos(' ',s)-1;
a[n]:=copy(s,1,i);
delete(s,1,i);
end;
end;
end;
BEGIN
write('vvedite text');
readln(s);
init_word(s,a,n);
max:=0;
for i:=1 to n do begin
m:=length(a[i]);
if m>max then begin max:=m;
w:=a[i];
end;
end;
writeln('slova rifmi',w,':');
w:=copy(w,length(w)-2,3);
for i:=1 to n do
if copy(a[i],length(a[i])-2,3)=w
then writeln(a[i]);
readln;
END.