two pointers and hashmap C++ solution
\nclass Solution {\npublic:\n    string entityParser(string text) {\n        string ans = "";\n        int n = text.length();\n        unordered_map <string,str
```\nclass Solution {\npublic:\n    string entityParser(string text) {\n        string ans = "";\n        int n = text.length();\n        unordered_map <string,string> mp = {{"&quot;","\\""},\n                                            {"&apos;","\'"},\n                                            {"&amp;","&"},\n                                            {"&gt;",">"},\n                                            {"&lt;","<"},\n                                            {"&frasl;","/"}\n                                           };\n        for(int i =0; i < n; i++){\n            if(text[i] != \'&\') ans += text[i];\n            else{\n                int size = 0;\n                int j = i;\n                string tmp = "";\n                bool found = false;\n                while(j < n && size <= 6){\n                    tmp += text[j];\n                    if(mp.find(tmp) != mp.end()){\n                        ans += mp[tmp]; \n                        i = j;\n                        found = true;\n                        break;\n                    }\n                    size++;\n                    j++;\n                }\n                if(!found) ans += \'&\';\n            }\n        }\n        return ans;\n    }\n};\n```
[]