Dsa
Stack
Medium
Balanced Braces Checker
Write a program that checks if a given string of braces is balanced. A string is considered balanced if each opening brace has a corresponding closing brace in the correct order. The braces can be of three types: (), {}, and []. For example, the string "{[()]}" is balanced while "{[(])}" is not.
Input
The input consists of a single line containing the string of braces.
Output
Print 'YES' if the string is balanced, otherwise print 'NO'.
Example
Input:
{[()]}
Output:
YES
Key concepts
stackparsing
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now