#K74557. Valid Parentheses String
Valid Parentheses String
Valid Parentheses String
You are given a string s
consisting only of the characters '(' and ')'. Your task is to determine whether the input string is a valid parentheses string.
A valid parentheses string is defined as follows:
- The empty string is valid.
- If A is a valid string, then \( (A) \) is also valid.
- If A and B are valid strings, then their concatenation \( AB \) is also valid.
For example, "()", "(())", and "()()" are valid, while ")(", "(()", and "(()()))" are not.
inputFormat
The input consists of a single line containing a string s
composed solely of the characters '(' and ')'.
You should read the input from standard input (stdin).
outputFormat
Output a single line containing either True
if the input string is a valid parentheses string or False
otherwise.
The output should be written to standard output (stdout).
## sample
True