#C5726. Balanced Parentheses Checker
Balanced Parentheses Checker
Balanced Parentheses Checker
You are given a string consisting solely of the characters '(' and ')'. Your task is to determine whether the parentheses in the string are balanced.
A string is considered balanced if every opening parenthesis \( ( \) has a corresponding closing parenthesis \( ) \) in the correct order. A common way to solve this problem is by using a stack: push when you see an opening bracket and pop when you see a closing bracket. If at any point a closing bracket is encountered when the stack is empty, or if the stack is non-empty after processing the entire string, then the string is unbalanced.
inputFormat
A single line containing a non-empty string composed only of the characters '(' and ')'.
outputFormat
Print "True" if the input string has balanced parentheses, or "False" otherwise. The output is case sensitive.## sample
()
True