Intuitive and brute force solution with comments
\nclass Solution {\npublic:\n    \n    string entityParser(string t) {\n        \n        int n  = t.length();\n        \n        //map to create the relation b
```\nclass Solution {\npublic:\n    \n    string entityParser(string t) {\n        \n        int n  = t.length();\n        \n        //map to create the relation between characters and special characters\n        map < string , string > m;\n        m["&quot;"] = \'"\';\n        m["&apos;"] = "\'";\n        m["&amp;"] = "&";\n        m["&gt;"] = ">";\n        m["&lt;"] = "<";\n        m["&frasl;"] = "/";\n        //ans stores the final ans and s stores the characters when we hit a & and continues till we hit a ;\n        string s= "", ans = "";\n        \n        for(int i = 0 ; i < n ; ){\n            //if present character is not & then add to final string and continue\n            if(t[i] != \'&\'){\n                ans.push_back(t[i]);\n                i++;\n                continue;\n            }else{\n                s="";\n                int j;\n                //get the entity in string s\n                for(j = i ; j<n ; ){\n                    if(t[j]==\';\'){\n                      s = s+t[j];\n                      break;\n                    }else{\n                       s = s+t[j];\n                       j++;\n                    }                    \n                }\n                //if the string in s is a special entity then add it from map, else just add s to the final string\n                if(m.find(s) != m.end())\n                    ans = ans + m[s];\n                else\n                    ans = ans + s;\n                //increase i after processing the special entity\n                i=j;\n                i++;\n            }            \n        }\n        \n        return ans;\n        \n    }\n};\n```
[]