Var Sim:array[0..10] of string;
function count_ya(var s: string): integer;
begin
var i, n, len: integer;
var c: char;
n := 0;
len := Length(s);
for i := 1 to len do begin
c := s[i];
if (c = 'я') or (c = 'Я') then begin
n := n + 1;
end;
end;
result := n;
end;
procedure word(var s: string);
begin
var i, c, k, j: integer;
c := count_ya(s);
for i := 0 to 10 do begin
if count_ya(Sim[i]) < c then begin
for k := 9 downto i do begin
Sim[k + 1] := Sim[k];
end;
Sim[i] := s;
break;
end;
end;
end;
Begin
Var C: Char;
Var i, k: integer;
Var f1: text;
Var s: string;
assign(f1, 'file1.txt');
reset(f1);
randomize;
i := 0;
while not Eof(f1) do begin
read(f1, C);
if ((C >= 'а') and (C <= 'я')) or ((C >= 'А') and (C <= 'Я')) then begin<br> i := 1;
s := s + C;
end else begin
if i = 1 then begin
word(s);
end;
i := 0;
s := '';
end;
end;
if i = 1 then begin
word(s);
end;
close(f1);
for i := 0 to 10 do begin
s := Sim[i];
if s = '' then break;
writeln(s);
end;
end.