O(n^3) TLE
O(n^2) also TLE
paren matched