Finds the closing bracket (works with any of '[', '(', '<', '{').
input string
whether to skip nested brackets
The index of the closing bracket or -1 for unbalanced strings and strings that don't start with a bracket.
See Implementation
Finds the closing bracket (works with any of '[', '(', '<', '{').