Tiny Command Interpreter
This is a small interpreter that reads a command and replaces short patterns with regular letters. Write a function interpret that processes a command made only from G, (), and (al). Replace G with G, () with o, and (al) with al. Return the fully interpreted string.
Примеры
Ввод
"G()(al)"Вывод
"Goal"Ввод
"G()()()()(al)"Вывод
"Gooooal"Ввод
"(al)G(al)()()G"Вывод
"alGalooG"Нужно реализовать
def interpret(command: str) -> str:
Теги
strings
Prijavite se za ogled zgodovine oddaj
PrijavaPrijavite se za uporabo mentorja UI
PrijavaVisible tests
1
Input
"G()(al)"Expected
"Goal"2
Input
"G()()()()(al)"Expected
"Gooooal"3
Input
"(al)G(al)()()G"Expected
"alGalooG"4
Input
"G"Expected
"G"5
Input
"()"Expected
"o"6
Input
"(al)"Expected
"al"Focus radio
Paused · SomaFM · Fluid