#C13610. Balanced Brackets Checker

    ID: 43168 Type: Default 1000ms 256MiB

Balanced Brackets Checker

Balanced Brackets Checker

You are given a string s that may contain letters and the following bracket characters: (', ')', '[', ']', '{', and '}'. Your task is to determine if the string is balanced.

A string is considered balanced if:

  • Every opening bracket has a corresponding closing bracket of the same type.
  • The brackets are closed in the correct order, i.e. they are properly nested.
  • Any character that is not one of these brackets can be ignored.

For example:

  • (){}[] is balanced.
  • (] is not balanced.
  • ([{}]) is balanced.

Your solution should read the input from stdin and output the result to stdout as either True or False (without quotes).

Note: If the input string is empty, it should be considered balanced.

inputFormat

The input consists of a single line containing a string s. The string may include letters, digits, spaces, and bracket characters.

Input Format: One line from stdin.

outputFormat

Output a single line to stdout containing either True or False depending on whether the string is balanced or not.

## sample
(){}[]
True