we only focus () and make the input valid.
std use bfs.
first how to dertermin it's valid? )( => false; which means we let each left bracket ++ and right bracket --; if we get a negative value in this process which means we get a ) and no (.
and the bfs will delete all ( or ) in any times.
string str = t.substr(0, i) + t.substr(i + 1);
if (!visited.count(str)) {
q.push(str);
visited.insert(str);
}
if we do not face this string before, we will delete this bracket and push it into the queue.