Tap here to switch tabs
Problem
Submissions

Problem: Goal Parser Interpretation

Goal Parser Interpretation gives you a command string of tokens and asks you to return the final string after interpreting each G, (), and (al) token as its mapped text.

Statement

You are given a string command that consists of a sequence of tokens. A parser interprets the input string by applying the following mappings:

  • "G" is interpreted as "G"

  • "()" is interpreted as "o"

  • "(al)" is interpreted as "al"

Return the final interpreted string after translating all tokens in command.

Constraints:

  • 1≤1 \leq command.length ≤100\leq 100

  • command consists of "G", "()", and/or "(al)" in some order.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Goal Parser Interpretation

Goal Parser Interpretation gives you a command string of tokens and asks you to return the final string after interpreting each G, (), and (al) token as its mapped text.

Statement

You are given a string command that consists of a sequence of tokens. A parser interprets the input string by applying the following mappings:

  • "G" is interpreted as "G"

  • "()" is interpreted as "o"

  • "(al)" is interpreted as "al"

Return the final interpreted string after translating all tokens in command.

Constraints:

  • 1≤1 \leq command.length ≤100\leq 100

  • command consists of "G", "()", and/or "(al)" in some order.