|  | 
|  | 
| back to board | I working hard in this program but i fet allvais CE? please help me. thencks varm : array [1..10000] of char;
 ch : char;
 lk , rk : integer;
 kin : boolean;
 tot ,step: integer;
 procedure wrong;
 begin
 writeln('NO');
 halt;
 end;
 begin
 tot := 0;
 repeat
 read(ch);
 inc(tot);
 m[tot] := ch;
 until ch = #26;
 step := 0;
 lk := 0;
 rk := 0;
 while step < tot do begin
 inc(step);
 if (m[step]='(') then begin
 if m[step+1] = '*' then begin
 step := step + 2;
 repeat
 inc(step);
 if step > tot then wrong;
 until (m[step]=')') and (m[step-1]='*');
 continue;
 end else inc(lk);
 end;
 if (m[step]=')') then inc(rk);
 if lk < rk then wrong;
 if (lk > rk) and not (m[step] in ['0'..'9','+','-
 ','*','/','=','(',')',#10,#13]) then wrong;
 end;
 if lk <> rk then wrong;
 writeln('YES');
 end.
 
 
Re: I working hard in this program but i fet allvais CE? please help me. thencks I'm having the same problem. Maybe, it's really better to readln andwriteln?
 | 
 | 
|