private boolean isInputBalanced(){
  Stack<Character> stack=new Stack<>();
  int length=input.length();
  for (int i=0; i < length; i++) {
    char currentChar=input.charAt(i);
    if (currentChar == BRACE_START) {
      stack.push(currentChar);
    }
 else     if (currentChar == BRACE_END) {
      if (stack.empty())       return false;
      if (stack.pop() != BRACE_START)       return false;
    }
  }
  return stack.empty();
}

private boolean isInputBalanced ( ) { Stack < Character > stack = new Stack < > ( ) ; int length = input . length ( ) ; for ( int i = 0 ; i < length ; i ++ ) { char currentChar = input . charAt ( i ) ; if ( currentChar == BRACE_START ) { stack . push ( currentChar ) ; } else if ( currentChar == BRACE_END ) { if ( stack . empty ( ) ) return false ; if ( stack . pop ( ) != BRACE_START ) return false ; } } return stack . empty ( ) ; }
checks whether input string is balanced analyzes only curly braces like { and } and ignores other characters
