uses crt;
var s,a,k:string; i,j,m,n,x,l:longint; c:char; dau:array[1..255]of longint;
begin
clrscr;
write('In:');readln(s);
k:=':;?.,-()!`~}{[]"/''|\';
write('OUT:');
for i:=1 to length(s) do
begin
if((i=n)or(i=1)or((i>1)and(s[i-1]=' ')))and(s[i]<>' ') then
begin
j:=i; while (s[j+1]<>' ')and(j<=length(s)) do inc(j);
a:=copy(s,i,j-i+1); m:=length(a); l:=m+1;
for x:=1 to m do
if pos(a[x],k)=0 then
begin
repeat dec(l); until pos(a[l],k)=0;
if dau[x]<>1 then begin c:=a[x]; a[x]:=a[l]; a[l]:=c; dau[l]:=1; end;
end;
write(a);
end;
if s[i]=' ' then write(' ');
end;
readln
end.
////////////////////////////////////////
Một số text cho bạn tham khảo: