Given a string of open bracket ‘(‘ and closed bracket ‘)’. The task is to find the length of longest balanced prefix.
Examples:
Input : S = "((()())())(("
Output : 10
From index 0 to index 9, they are forming
a balanced parentheses prefix.
Input : S = "()(())((()"
Output : 6
Length of longest balanced parentheses prefix : https://www.geeksforgeeks.org/length-longest-balanced-parentheses-prefix/