Здравейте имам проблем със задача 8 Balanced Parentheses, може ли малко помощ
Problem 8. Balanced Parentheses
Given a sequence consisting of parentheses, determine whether the expression is balanced. A sequence of
parentheses is balanced if every open parenthesis can be paired uniquely with a closed parenthesis that occurs
after the former. Also, the interval between them must be balanced. You will be given three types of
parentheses: (, {, and [.
{[()]} - This is a balanced parenthesis.
{[(])} - This is not a balanced parenthesis.
Input
Each input consists of a single line, the sequence of parentheses.
Output
For each test case, print on a new line "YES" if the parentheses are balanced.
Otherwise, print "NO". Do not print the quotes.
Constraints
1 ≤ len s ≤ 1000, where len s is the length of the sequence.
Each character of the sequence will be one of {, }, (, ), [, ].
Examples
Input Output
{[()]} YES
{[(])} NO
{{[[(())]]}} YES
моят код ми дава 87/100
линк:https://pastebin.com/zvtiH2Mv
Бих искала да знам,къде греша и ще ви бъда благодарна ако ми помогнете
Благодаря за бързия отговор и обясненията :)