(s [i]) -48;
end;
q: = ms [q, ns];
if ns = 0 then
begin
ee: = false;
writeln (1);
end else
if q = 0 then
begin
ee: = false;
writeln (2);
end;
inc (i);
end;
if ee then
if q = 6 then writeln ('0 '# 13 # 10'p1 =', p1, 'p2 =', p2, 'k =', sign * cons)
else writeln (3);
close (input);
close (output);.
Варіант № 2: ms: array [1 .. 4,1 .. 4] of byte = (
{Ц (),}
{S} (0,2,0,0),
{Q} (3,0,0,0),
{P} (3,0,4,2),
{Z} (0,0,0,0)); ps: array [1 .. 4,1 .. 4] of byte = (
{Ц (),}
{S} (0,1,0,0),
{Q} (2,0,0,0),
{P} (2,0,0,1),
{Z} (0,0,0,0));
num: set of char = ['0 '.. '9'];
ee: boolean = true; s: string;
i, q, oq, ns: byte;
col: byte;
M: array [1 .. 100] of word;
assign (input, 'input.txt');
assign (output, 'output.txt');
reset (input);
rewrite (output);
readln (s);
col: = 0; i: = 1; q: = 1;
fillchar (m, 200,0);
writeln (s); i: = 1; q: = 1;
while (i <= byte (s [0])) and ee do
begin
oq: = q;
if s [i] in num then ns: = 1 else {}
if s [i] = '(' then ns: = 2 else {Визначення}
if s [i] = ')' then ns: = 3 else {номери}
if s [i] = ',' then ns: = 4 else ns: = 0; {символу}
case ps [q, ns] of
1: inc (col);
2: m [col]: = m [Col] * 10 + byte (s [i]) -48;
end;
q: = ms [q, ns];
if ns = 0 then
begin
ee: = false;
writeln (1);
end else
if q = 0 then
begin
ee: = false;
writeln (2);
end;