>When no more interesting kata can be resolved, I just choose to create the new kata, to solve their own, to enjoy the process  --myjinxin2015 said
# Description:
 Given a string `str` that contains some "(" or ")". Your task is to find the longest substring in `str`(all brackets in the substring are closed). The result is the length of the longest substring.
 For example:
 ```
 str = "()()("
 findLongest(str) === 4 
 "()()" is the longest substring
 ```
# Note:
 - All inputs are valid.
 - If no such substring found, return 0.
 - Please pay attention to the performance of code. ;-)
 - In the performance test(100000 brackets str x 100 testcases), the time consuming of each test case should be within 35ms. This means, your code should run as fast as a rocket ;-) 
# Some Examples
 ```
 findLongest("()") === 2
 findLongest("()(") === 2
 findLongest("()()") === 4
 findLongest("()()(") === 4
 findLongest("(()())") === 6
 findLongest("(()(())") === 6
 findLongest("())(()))") === 4
 findLongest("))((") === 0
 findLongest("") === 0
 ```

def find_longest(string): 
    n = len(string) 
  
    # Create a stack and push -1 as initial index to it. 
    stk = [] 
    stk.append(-1) 
  
    # Initialize result 
    result = 0
  
    # Traverse all characters of given string 
    for i in range(n): 
      
        # If opening bracket, push index of it 
        if string[i] == '(': 
            stk.append(i) 
  
        else:    # If closing bracket, i.e., str[i] = ')' 
      
            # Pop the previous opening bracket's index 
            stk.pop() 
      
            # Check if this length formed with base of 
            # current valid substring is more than max  
            # so far 
            if len(stk) != 0: 
                result = max(result, i - stk[len(stk)-1]) 
  
            # If stack is empty. push current index as  
            # base for next valid substring (if any) 
            else: 
                stk.append(i) 
  
    return result 

def find_longest(string): 
    n = len(string) 
  
    # Create a stack and push -1 as initial index to it. 
    stk = [] 
    stk.append(-1) 
  
    # Initialize result 
    result = 0
  
    # Traverse all characters of given string 
    for i in range(n): 
      
        # If opening bracket, push index of it 
        if string[i] == '(': 
            stk.append(i) 
  
        else:    # If closing bracket, i.e., str[i] = ')' 
      
            # Pop the previous opening bracket's index 
            stk.pop() 
      
            # Check if this length formed with base of 
            # current valid substring is more than max  
            # so far 
            if len(stk) != 0: 
                result = max(result, i - stk[len(stk)-1]) 
  
            # If stack is empty. push current index as  
            # base for next valid substring (if any) 
            else: 
                stk.append(i) 
  
    return result 