#C679. Taco's Curly Braces Validator

    ID: 50588 Type: Default 1000ms 256MiB

Taco's Curly Braces Validator

Taco's Curly Braces Validator

Given a string S consisting only of the characters { and }, determine whether the string represents valid function definitions by ensuring that every opening brace { has a corresponding closing brace } in the correct order. Formally, the string is valid if it is balanced, i.e., if we denote an opening brace as \(\{\) and a closing brace as \(\}\), the string is valid if every \(\{\) is matched with a \(\}\) and the overall sequence is well-formed. An empty string is also considered valid.

inputFormat

The input consists of a single line containing the string S composed exclusively of the characters { and }. Note that S may be an empty string.

outputFormat

Output a single line: YES if the input string S is balanced (i.e., represents valid function definitions), and NO otherwise.

## sample
{}
YES