fork(2) download
  1. var
  2. c,v:char;
  3. q,w,e:longint;
  4. s:string;
  5. procedure R;
  6. var q : longint;
  7. v :char;
  8. begin
  9. q:=1;
  10. while length(s)<>0 do if (s[q]='(') or (s[q]='[') or (s[q]='{') then begin
  11. v:=s[q];
  12. w:=q;
  13. inc(q);
  14. end else
  15. if ((s[q]=')') and (v='(')) or ((s[q]=']') and (v='[')) or ((s[q]='}') and (v='{')) then begin
  16. delete(s,w,1);
  17. dec(q);
  18. delete(s,q,1);
  19. R;
  20. end else begin writeln('Нет'); close(output); halt; end;
  21. end;
  22.  
  23. begin
  24. readln(s);
  25. R;
  26. writeln('Да');
  27. close(output);
  28. end.
  29.  
Runtime error #stdin #stdout 0s 276KB
stdin
Standard input is empty
stdout
Runtime error 2 at $0804821D
  $0804821D