- 正则表达式
/**
* @param {string} command
* @return {string}
*/
var interpret = function (command) {
const map = {
"()": "o",
"(al)": "al",
};
return command.replace(/\(al\)|\(\)/g, (match) => map[match]);
};
/**
* @param {string} command
* @return {string}
*/
var interpret = function (command) {
const map = {
"()": "o",
"(al)": "al",
};
return command.replace(/\(al\)|\(\)/g, (match) => map[match]);
};