#K51447. Balanced Brackets Checker
Balanced Brackets Checker
Balanced Brackets Checker
You are given a string s
which may contain the characters \( ( \), \( ) \), \( { \), \( } \), \( [ \) and \( ] \) among other possible characters. Your task is to determine whether the brackets in the string are properly balanced.
A string is considered to be balanced if:
- Every opening bracket has a corresponding closing bracket of the same type.
- The pairs of brackets are properly nested.
- Characters other than the brackets should be ignored.
Note that an empty string is considered balanced.
inputFormat
The input is read from standard input and consists of a single line string s
.
outputFormat
Output to standard output a single line: True
if the brackets in the string are balanced, or False
otherwise.
()
True