A Goal Parser reads a `command` string made only of the pieces `"G"`, `"()"` and `"(al)"`, in some order. It reads `"G"` as `"G"`, `"()"` as `"o"` and `"(al)"` as `"al"`, then joins the decoded pieces in their original order. Return the Goal Parser's interpretation of `command`.
A Goal Parser reads a command string made only of the pieces "G", "()" and "(al)", in some order. It reads "G" as "G", "()" as "o" and "(al)" as "al", then joins the decoded pieces in their original order. Return the Goal Parser's interpretation of command.
Example 1:
Input: {"command":"G()(al)"}
Output: Goal
Constraints:
1 <= command.length <= 100
command consists of "G", "()" and/or "(al)" in some order.
Test Cases
Input (Stdin)
Expected Output (Stdout)
Execution Result
Run code to see results.
Input
arr ={"command":"G()(al)"}
Put the read head at i = 0. Each step looks at command[i]: a 'G' is one character, a '(' starts either "()" or "(al)".