She said s(he) be(lie)ve(d), he said sbeve.
Input
- A non-empty string,
s
. It's guaranteed thats
will have only printable ASCII characters and at least one word (defined as[A-Za-z0-9]+
) in parentheses, and all parentheses will be closed respectively.
Output
- A string containing all non-whitespace characters (whitespaces are defined as spaces, tabs, carriage returns, new lines, vertical tabs and form feeds characters) that are not in parentheses.
Test cases
Input -> Output
s(he) be(lie)ve(d) -> sbeve
s(h3) (1s) br(0k)3n -> sbr3n
(I) (K)now (Ill) Be
(My) Best (Self) -> nowBeBest
sho(u)lder (should)er
s(ho)u(ld)er s(h)ould(er) -> sholderersuersould
p(er)f(ection) -> pf
(hello) (world) ->
The last output is an empty string.
This is code-golf so shortest code in bytes wins.
s
will have only printable ASCII characters. "Printable ASCII" means code points from 32 to 126 (both included), and therefore the only whitespace allowed in the input is the normal space character (so no tabs, newlines etc). Can you confirm, and perhaps edit the challenge text accordingly? \$\endgroup\$