#K16176. Balanced Brackets

    ID: 24521 Type: Default 1000ms 256MiB

Balanced Brackets

Balanced Brackets

Given a string s that consists solely of the characters ( ) { } [ ], you are required to determine whether the bracket sequence in s is balanced. A sequence is considered balanced if every opening bracket has a corresponding closing bracket of the same type and the pairs of brackets are properly nested. Formally, the input string s is balanced if it meets the following condition:

\( \text{For every opening bracket, there exists a corresponding closing bracket, and the brackets are closed in the correct order.} \)

For example, the sequence ()[]{} is balanced, but ([)] is not. An empty string should be considered balanced.

inputFormat

The input consists of a single line containing the string s composed exclusively of the characters (, ), {, }, [ and ]. Note that the string can be empty.

outputFormat

Output a single line: True if the string s is a balanced sequence of brackets, otherwise output False.

## sample
()[]{}
True