Ответ:
program setof;
var
n16: set of Char;
s, w: string;
i, n: Integer;
c: Char;
Is16: Boolean;
begin
n16 := ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'];
Write ('Введите строку: ');
ReadLn (s);
w := '';
Is16 := True;
n := 0;
for i := 1 to Length (s) do begin
c := s [i];
if (c = ' ') or (i = Length (s)) then begin
if Is16 then begin
Inc (n);
WriteLn (w);
end;
w := '';
Is16 := True;
Continue;
end;
if Is16 and (c in n16) then
w := w + c
else begin
Is16 := False;
w := '';
end;
end;
WriteLn ('Количество 16-ричных чисел = ', n);
ReadLn;
end.
Объяснение:
В вводимой строке символ разделитель - пробел