program XoaSoLienTuc;
uses sysutils;
function XoaSoLienTuc(S: string): string;
var
i: integer;
result: string;
begin
result := ''
for i := 1 to Length(S) do
begin
if not (S[i] in ['0'..'9']) then
begin
if (i = 1) or (S[i-1] in ['0'..'9']) then
result := result + ' '
result := result + S[i];
end;
end;
result := Trim(result);
result := StringReplace(result, ' ', '', [rfReplaceAll]);
XoaSoLienTuc := result;
end;
var
S: string;
begin
write('Nhập vào xâu S: ');
readln(S);
writeln('Kết quả: ', XoaSoLienTuc(S));
end.