Balance
Balance
{
//Function to check if opening and closing brackets are of same type.
static boolean cmp(char b, char c)
{
if(b=='{' && c=='}')
return true;
else if(b=='[' && c==']')
return true;
else if(b=='(' && c==')')
return true;
return false;
}