Clean python solution without replace
I think that the interviewer wouldn\'t allow the use of string functions such as replace for this question as it would be pretty much meaningless. Here is a sim
I think that the interviewer wouldn\'t allow the use of string functions such as replace for this question as it would be pretty much meaningless. Here is a simple python solution without using replace:\n\n```\nclass Solution:\n    def entityParser(self, text: str) -> str:\n        replaceDict={"&quot;":\'"\',"&apos;":"\'","&amp;":"&","&gt;":">","&lt;":"<","&frasl;":"/"}\n        replaceMode=False\n        keyword=[]\n        out=[]\n        for c in text:\n            if c=="&":\n                replaceMode=True\n                keyword=["&"]\n            elif replaceMode:\n                keyword.append(c)\n                if c==";":\n                    keyword=\'\'.join(keyword)\n                    out.append(replaceDict.get(keyword,keyword)) #if it wasn\'t found in dict, just add the existing word\n                    replaceMode=False\n            else:\n                out.append(c)\n        if replaceMode:\n            out+=keyword\n        return \'\'.join(out)\n```
[]