program IspisujeSvojKod;
{$APPTYPE CONSOLE}
uses
SysUtils;
const
Zs='';
P1=' writeln(Ls+';
P2='+Ds);';
P3='+A+';
P4=' writeln(P);';
M1=' Promena(Ls,Ds,A,P);';
M2=' end;';
M3=' readln;';
M4='end.';
procedure Promena(var Ls,Ds,A,P: string);
begin
if Ls=Zs then
begin
Ls:=P1+chr(39);
Ds:=chr(39)+P2;
A:=chr(39)+P3+chr(39);
P:=P4;
end else
begin
writeln(M1);
writeln(M2);
writeln;
writeln(M3);
writeln;
write(M4);
end;
end;
var
Ls,Ds,A,P:string;
i:integer;
begin
Ls:=Zs; Ds:=Zs; A:=chr(39); P:=Zs;
for i:=1 to 2 do
begin
writeln(Ls+'program IspisujeSvojKod;'+Ds);
writeln(P);
writeln(Ls+'{$APPTYPE CONSOLE}'+Ds);
writeln(P);
writeln(Ls+'uses'+Ds);
writeln(Ls+' SysUtils;'+Ds);
writeln(P);
writeln(Ls+'const'+Ds);
writeln(Ls+' Zs='+A+''+A+';'+Ds);
writeln(Ls+' P1='+A+' writeln(Ls+'+A+';'+Ds);
writeln(Ls+' P2='+A+'+Ds);'+A+';'+Ds);
writeln(Ls+' P3='+A+'+A+'+A+';'+Ds);
writeln(Ls+' P4='+A+' writeln(P);'+A+';'+Ds);
writeln(Ls+' M1='+A+' Promena(Ls,Ds,A,P);'+A+';'+Ds);
writeln(Ls+' M2='+A+' end;'+A+';'+Ds);
writeln(Ls+' M3='+A+' readln;'+A+';'+Ds);
writeln(Ls+' M4='+A+'end.'+A+';'+Ds);
writeln(P);
writeln(Ls+'procedure Promena(var Ls,Ds,A,P: string);'+Ds);
writeln(Ls+'begin'+Ds);
writeln(Ls+' if Ls=Zs then'+Ds);
writeln(Ls+' begin'+Ds);
writeln(Ls+' Ls:=P1+chr(39);'+Ds);
writeln(Ls+' Ds:=chr(39)+P2;'+Ds);
writeln(Ls+' A:=chr(39)+P3+chr(39);'+Ds);
writeln(Ls+' P:=P4;'+Ds);
writeln(Ls+' end else'+Ds);
writeln(Ls+' begin'+Ds);
writeln(Ls+' writeln(M1);'+Ds);
writeln(Ls+' writeln(M2);'+Ds);
writeln(Ls+' writeln;'+Ds);
writeln(Ls+' writeln(M3);'+Ds);
writeln(Ls+' writeln;'+Ds);
writeln(Ls+' write(M4);'+Ds);
writeln(Ls+' end;'+Ds);
writeln(Ls+'end;'+Ds);
writeln(P);
writeln(Ls+'var'+Ds);
writeln(Ls+' Ls,Ds,A,P:string;'+Ds);
writeln(Ls+' i:integer;'+Ds);
writeln(P);
writeln(Ls+'begin'+Ds);
writeln(P);
writeln(Ls+' Ls:=Zs; Ds:=Zs; A:=chr(39); P:=Zs;'+Ds);
writeln(P);
writeln(Ls+' for i:=1 to 2 do'+Ds);
writeln(Ls+' begin'+Ds);
Promena(Ls,Ds,A,P);
end;
readln;
end.