public static int longestValidParentheses_Wrong(String s) {

    Stack<Character> stack = new Stack<Character>();

    // a rule to keep is that '(' must not smaller than ')'
    // ())()false
    int max = 0;
    int tempMax = 0;

    // ///////////////////////////////////
    // WE DON'T PUT ')' INTO THE STACK///
    // //////////////////////////////////
    for (int i = 0 ; i < s.length() ; i++) {
      char ch = s.charAt(i);
      if (ch == '(') { // left is easy, always push it to the stack
        stack.push(ch);
      } else { // ')'
        if (stack.isEmpty()) {
          // leftIdx = i + 1;
          tempMax = 0;
        } else {
          stack.pop();
          tempMax += 2;
          if (tempMax > max) {
            max = tempMax;
          }
        }
      }
    }

    return max;
  }