Driver Code
public static void main ( String [ ] args ) { char X [ ] = " [ ( ) ] ( ) " . toCharArray ( ) ; int n = 6 ; if ( isBalanced ( X , n ) ) System . out . printf ( "YesNEW_LINE"); else System . out . printf ( "NoNEW_LINE"); char Y [ ] = " [ [ ( ) ] ] ) " . toCharArray ( ) ; n = 7 ; if ( isBalanced ( Y , n ) ) System . out . printf ( "YesNEW_LINE"); else System . out . printf ( "NoNEW_LINE"); } }