#C13204. Balanced Brackets Checker
Balanced Brackets Checker
Balanced Brackets Checker
Given a string s
containing only the characters (
, )
, {
, }
, [
, and ]
, determine if the brackets are balanced.
A string is considered balanced if it satisfies the following conditions:
- $\text{Every opening bracket has a corresponding closing bracket.}$
- $\text{Brackets must be closed in the correct order.}$
For example, "()[]{}"
is balanced, while "([)]"
is not.
inputFormat
The input consists of a single line containing a string s
composed solely of the characters (
, )
, {
, }
, [
, and ]
. Note that the string may be empty.
outputFormat
Output True
if the input string is balanced according to the rules; otherwise, output False
. The answer should be printed on a single line.
()
True