var
a,t:string;
b:array[1..100]of string;
j,i,k,n:integer;
begin
writeln('vvedite predlojenie');
readln(a);
a:=' '+a;
for i:=1 to length(a) do
if a[i]=' 'then inc(k) else b[k]:=b[k]+a[i];
writeln('slova s odinakovymi 1 i posledney bukvoy');
for i:=1 to k do
begin
t:=b[i];
if t[1]=t[length(t)] then write(t,' ');
end;
writeln;
writeln ('slova s 3 e');
for i:=1 to k do
begin
n:=0;
t:=b[i];
for j:=1 to length(t) do
if t[j]='e' then inc(n);
if n=3 then write (t,' ');
end;
writeln;
writeln('slova s bukvoy o');
for i:=1 to k do
begin
n:=0;
t:=b[i];
for j:=1 to length(t) do
if t[j]='o' then n:=1;
if n=1 then write (t,' ');
end;
end.