program uasarsip;
{$APPTYPE CONSOLE}
uses
SysUtils;
var
filestr: text;
c: array [1..100] of string ;
z,x:string;
poschar, p: integer;
zs,huruf: string;
awalspasi: boolean;
nc: integer;
k,cs: string;
m,n:integer;
begin
{ TODO -oUser -cConsole Main : Insert code here }
readln (x);
writeln;
{algoritma mengambil kalimat}
awalspasi:= false;
p:= length (x);
poschar:= 1;
while poschar <= p do
begin
huruf:= copy (x, poschar, 1);
if huruf=' ' then zs:= ''
else
if huruf='/' then
if awalspasi = false then
begin
z:= zs;
awalspasi:= true;
end
else z:= z + ' '+ zs
else
zs:=zs +huruf;
poschar:=poschar+1;
end;
writeln (z);
{algoritma memasukkan tiap kata ke dalam array}
nc:=1;
p:= length (z);
poschar:= 1;
while poschar <= p do
begin
k:= copy (z, poschar, 1);
if k=' ' then
begin
c[nc]:=cs;
cs:='';
nc:=nc+1
end
else
cs:= cs+k;
poschar:=poschar+1;
end;
c[nc]:=cs;
for i:= 1 to nc do
writeln (c[i]);
assign (filestr, 'c:/data/uasoutput.txt');
rewrite (filestr);
writeln(filestr, z);
for i:= 1 to nc do
begin
writeln (filestr,c[i]);
end;
close (filestr);
writeln;
readln;
end.
{$APPTYPE CONSOLE}
uses
SysUtils;
var
filestr: text;
c: array [1..100] of string ;
z,x:string;
poschar, p: integer;
zs,huruf: string;
awalspasi: boolean;
nc: integer;
k,cs: string;
m,n:integer;
begin
{ TODO -oUser -cConsole Main : Insert code here }
readln (x);
writeln;
{algoritma mengambil kalimat}
awalspasi:= false;
p:= length (x);
poschar:= 1;
while poschar <= p do
begin
huruf:= copy (x, poschar, 1);
if huruf=' ' then zs:= ''
else
if huruf='/' then
if awalspasi = false then
begin
z:= zs;
awalspasi:= true;
end
else z:= z + ' '+ zs
else
zs:=zs +huruf;
poschar:=poschar+1;
end;
writeln (z);
{algoritma memasukkan tiap kata ke dalam array}
nc:=1;
p:= length (z);
poschar:= 1;
while poschar <= p do
begin
k:= copy (z, poschar, 1);
if k=' ' then
begin
c[nc]:=cs;
cs:='';
nc:=nc+1
end
else
cs:= cs+k;
poschar:=poschar+1;
end;
c[nc]:=cs;
for i:= 1 to nc do
writeln (c[i]);
assign (filestr, 'c:/data/uasoutput.txt');
rewrite (filestr);
writeln(filestr, z);
for i:= 1 to nc do
begin
writeln (filestr,c[i]);
end;
close (filestr);
writeln;
readln;
end.