#231. 括号嵌套判断
括号嵌套判断
Parenthesis Nesting Check
Background
Congcong is learning string processing, and Dawei has given him a problem about parenthesis nesting.
Problem Description
Given a string, return true if it is a nesting of zero or more pairs of parenthesis, like (()) or ((())). Suggestion: check the first and last characters, and then recur on what's inside them.
Input Format
Input is given from standard input in the following format.
A string .
Output Format
Output is printed to standard output in the following format.
Output
trueif the string meets the requirements; otherwise, outputfalse.
Sample
(
true
((
true
(((
false
Sample Explanation
None
Constraints
Time limit: 1 second, Memory limit: 1024 KiB for each test case.