[} ((())){}
 l        r

add(c)
  if (c is open)
    stack.push(position of c)
  else if (matches)
    relax(position of c - stack.top())
  else
    stack.clear()
    stack.push((position of c) - 1)