program variandid; var s: string; procedure trykiVariandid(paigas, vaba: string); var uuspaigas, uusvaba: string; i: integer; begin writeln(paigas); for i:=1 to length(vaba) do begin uuspaigas:=paigas+copy(vaba, i, 1); uusvaba:=vaba; delete(uusvaba, i, 1); trykiVariandid(uuspaigas, uusvaba); end; end; begin writeln('Palun tekst:'); readln(s); trykiVariandid('', s); end.