program Prog;
var
& s, s1, sf: String;
& i, len:integer;
& f: boolean;
begin
& writeln('Write your string:');
& readln(s);
& if pos(' ', s)=0 then writeln('.') else
& begin
i := length(s)-1;
s1:='';
while s[i]<>' ' do
begin
s1 := s[i] + s1;
dec(i);
end;
f := true;
sf:='';
while f do
begin
if s1 = copy(s,1,pos(' ', s)-1) then
else
begin
& sf:=sf+copy(s,1,pos(' ', s));
end;
delete(s,1,pos(' ', s));
if pos(' ', s)=0 then f:= false;
end;
sf:=sf+s;
len := 0;
f:=true;
s:=sf;
while f do
begin
if ((pos(' ',s)-1)>len)then len:=pos(' ',s)-1;
delete(s,1,pos(' ', s));
if pos(' ', s)=0 then f:= false;
end;
if ((length(s)-1) > len) then
begin
writeln(copy(sf,1,pos(s,sf)-2),'.');
end else
begin
f:=true;
s:=sf;
sf:='';
while f do
begin
& if ((pos(' ',s)-1)=len)then
& else
sf:=sf+copy(s,1,pos(' ', s));
& delete(s,1,pos(' ', s));
& if pos(' ', s)=0 then f:= false;
end;
if (length(s)-1)=len then
begin
& if sf<>'' then sf[length(sf)] := '.' else sf:='.';
end
else sf:=sf+s;
writeln(sf);
end;
& end;
end.& &
Comments
You're welcome! We are glad to be helpful. If you really liked our service please press like-button beside answer field. Thank you!
this is awesome.thanks alot!
Leave a comment