How do you get the string position of the closing bracket that belongs to the first bracket? The beginning of the string is always a {.
Sample input:
1. latex = "{123{4}{5}{6}789}101112"
2. latex2 = "{1{2}{3}}”
3. latex3 = “{1{2}{3}}{4}{5}
Sample output:
1. getcBracketPosition(latex) // return 16
2. getcBracketPosition(latex2) // return 7
3. getcBracketPosition(latex3) // return 7
How do I write the function, getcBracketPosition(latex)?