1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
| program make1;
var
i, o: text;
s: string;
a, b, c, d, e: longint;
begin
Assign(i, '002.txt');
Reset(i);
Assign(o, '003.txt');
Rewrite(o);
while not Eof(i) do
begin
ReadLn(i, s);
a := 1;
while not ((s[a] = '&') and (s[a + 1] = '#') and (s[a + 2] <> 'x')) do Inc(a);
b := 0;
while s[a + b + 2] in ['0'..'9'] do Inc(b);
Val(Copy(s, a + 2, b), c, d);
if (d = 0) and (c >= 33) and (c <= 255) then
begin
e := Pos(' ', s);
WriteLn(
o,
'''',
Chr(c),
''': result := ''',
Copy(s, 1, e - 1),
''';'
);
end;
end;
Close(i);
Close(o);
end. |
Partager