mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-07-05 00:25:22 +08:00
23 lines
328 B
Go
23 lines
328 B
Go
package leetcode
|
|
|
|
func interpret(command string) string {
|
|
if command == "" {
|
|
return ""
|
|
}
|
|
res := ""
|
|
for i := 0; i < len(command); i++ {
|
|
if command[i] == 'G' {
|
|
res += "G"
|
|
} else {
|
|
if command[i] == '(' && command[i+1] == 'a' {
|
|
res += "al"
|
|
i += 3
|
|
} else {
|
|
res += "o"
|
|
i++
|
|
}
|
|
}
|
|
}
|
|
return res
|
|
}
|