https://leetcode.com/problems/goal-parser-interpretation/

Source


    string interpret(string command) {
        unordered_map<string, string> lut {
            {"()", "o"},
            {"(al)", "al"}
        };
        for (auto it=begin(lut); it!=end(lut); ++it) {
            auto itC = command.find(it->first);
            while (itC != std::string::npos) {
                command.replace(itC, it->first.length(), it->second);
                itC = command.find(it->first);
            }
        }
        return command;
    }

GitHub