function foo(s: string; n: integer): string;
begin
if n = 1 then foo := s[1]
else foo := s[n] + foo(s, n - 1)
end;
var s := 'наоборот';
Print(foo(s, s.Length))
end.
function foo(s: string; n: integer): string;
begin
if n = 1 then foo := s[1]
else foo := s[n] + foo(s, n - 1)
end;
begin
var s := 'наоборот';
Print(foo(s, s.Length))
end.