using System.Collections;
public static void Main()
if(string.IsNullOrWhiteSpace(exp)){
Console.WriteLine("not balanced");
if(c == '{' || c == '(' || c == '['){
else if(c =='}' || c == ')' || c == ']'){
var prev = (char)stack.Pop();
if(c == '}' && prev == '{') continue;
if(c == ']' && prev == '[') continue;
if(c == ')' && prev == '(') continue;
Console.WriteLine("not balanced");
Console.WriteLine("balanced");