Parentheses¶
Given a string composed of round brackets () and square brackets []. Your goal is to check whether the string contains correct parentheses or not. We consider a string to be correct when:
- is an empty string,
- if
and are correct, then is also correct, - if
is correct, then and are also correct.
Source: https://onlinejudge.org/external/6/673.pdf
Specification¶
Input¶
- string of parentheses
Output¶
- Information whether the string is correct or not.