#C12819. Balanced Parentheses Checker
Balanced Parentheses Checker
Balanced Parentheses Checker
Given a string s that may contain parentheses and other characters, your task is to determine whether the parentheses in s are balanced.
A string is said to have balanced parentheses if every opening parenthesis '(' has a corresponding closing parenthesis ')' and they appear in the correct order. Non-parenthesis characters should be ignored. For example, the string "abc"
is considered balanced.
The answer should be output as either True
or False
.
inputFormat
The input consists of a single line containing the string s.
outputFormat
Output a single line containing True
if the parentheses are balanced, or False
otherwise.
((()))
True
</p>