Goal Parser Interpretation
class Solution:
def interpret(self, command: str) -> str:
cache = {
'G': 'G',
'()': 'o',
'(al)': 'al'
}
lx = 0
result = []
while lx < len(command):
for k, v in cache.items():
if command[lx::].startswith(k):
result.append(v)
lx = lx + len(k)
return ''.join(result)