Updated Q.A2
public text v1 · immutableProgram QA2;
VAR
C : char;
infile : text;
Begin
Assign(infile,'text.txt');
Reset(infile);
Repeat
Repeat
Read(infile,c);
If c IN ['!','.','?',' '] then
Begin
If c <> ' ' then Write(c);
Repeat
read(infile,c);
Until(c <> ' ');
Write (' ');
Write (c);
End
Else
Write(c);
Until(EOLN(Infile));
Readln(infile);
Writeln;
Until(EOF(Infile));
Close(infile);
End.