def solution(strr):
 closerof = {'{': '}', '[': ']', '(': ')'}
 Start = ('[', '{', '(')
 Closer = (']', '}', ')')
 stack = []
 for i in strr:
  if (i in Start):
   stack.append(i)
  elif (i in Closer):
   if (closerof[stack[(-1)]] == i):
    stack.pop()
   else:
    return False
 return (not stack)

def solution ( strr ) : closerof = { '{' : '}' , '[' : ']' , '(' : ')' } Start = ( '[' , '{' , '(' ) Closer = ( ']' , '}' , ')' ) stack = [ ] for i in strr : if ( i in Start ) : stack . append ( i ) elif ( i in Closer ) : if ( closerof [ stack [ ( - 1 ) ] ] == i ) : stack . pop ( ) else : return False return ( not stack )
check if all brackets closed properly .