private static final char getEndingParenthesis(char cc) {
        return cc == '{' ? '}': cc == '(' ? ')': cc == '[' ? ']': (char)0;
    }