А потестируйте:
Код:
program az;
var
s1,s2:String;
s:Array[1..255] of Char;
i,i1,i2,j,N:Byte;
ch:Char;
BEGIN
writeln ('Введите строку:');
readln(s1);
N:=0;
i:=0;
i1:=0;
i2:=0;
Repeat
Inc(i);
If (i>1) and (s1[i-1]<>'-') and (s1[i]='-') then i1:=Ord(s1[i-1]);
If (i>1) and (s1[i-1]='-') and (s1[i]<>'-') then i2:=Ord(s1[i]);
If (i1>0) and (i2>0) then
begin
for j:=i1 to i2 do
s[N+j+1-i1]:=Chr(j);
Inc(N,(i2-i1+1));
i1:=0;
i2:=0;
end;
Until i=Length(s1);
s2:=s;
Writeln(s2);
Readln;
END.