Description
You own a Goal Parser that can interpret a string command. The command consists of "G", "()" and "(al)". Parse to return "G", "o", and "al" respectively.
Examples
Input:
command = "G()(al)"Output:
"Goal"Explanation:
G + o + al = Goal.
Input:
command = "(al)"Output:
alExplanation:
The string contains only (al) which maps to 'al' according to the parsing rules.
Input:
command = "G()G(al)G"Output:
GoGalGExplanation:
G stays as G, () becomes o, G stays as G, (al) becomes al, and G stays as G, resulting in GoGalG.
Constraints
- •
1 ≤ command.length ≤ 100