fork download
  1. import re
  2. s = "(NP (NN (Police)) (SBAR (SC (for)) (S (NP-SBJ (*)) (VP (VB (secure)) (NP (NN (olympic games)))))))"
  3. print(re.sub(r'\(([^()]*)\)', r'\1', s))
Success #stdin #stdout 0.02s 27744KB
stdin
Standard input is empty
stdout
(NP  (NN  Police) (SBAR  (SC for) (S  (NP-SBJ  *) (VP  (VB secure) (NP  (NN      olympic games))))))