Gimbap(김밥) is Korean food, somewhat looks like sushi roll.
Here is Korean emoticon represent Gimbap : @))))))))))
Your quest is make ASCII Gimbap cutter.
Rule
Input is string made with only @
and )
.
Output cuts every valid Gimbap with )
, and then add
@
between them. So for example @))
to @) @)
.
Valid Gimbap starts with @
and followed by any amount of )
.
If there is no valid Gimbap, output is blank.
Input and output
Input | Output
@))))) | @) @) @) @) @)
@))))))) | @) @) @) @) @) @) @)
@))@))) | @) @) @) @) @)
@) | @)
)) |
@ |
@@)@@@))) | @) @) @) @)
@)@)@)) | @) @) @) @)
@@@)) | @) @)
))@) | @)
Winning condition
This is code-golf, so shortest code wins.
from sandbox
@)
for every)
in the input not counting those before any@
? May our output include a trailing space, like"@) @) "
? \$\endgroup\$