#C12787. Valid Parentheses Check
Valid Parentheses Check
Valid Parentheses Check
Given a string that may contain various characters, the task is to determine whether the parentheses in the string are well-formed. Non-parenthesis characters should be ignored. A string is considered valid if every opening parenthesis '(' has a corresponding closing parenthesis ')' and the pairs are properly nested. In other words, the string is valid if it satisfies the condition (#( = #)) and at no point when scanning from left to right does the number of closing parentheses exceed the number of openings.
inputFormat
The input consists of a single line (or multiple lines) containing a string. The string may include any characters. Input must be read from stdin.
outputFormat
Print a single line to stdout: 'True' if the string has valid parentheses, and 'False' otherwise.## sample
(a(b(c)d)e(f)
True
</p>