c++ string processing. easy to explain and impl in 5mins. cheers!
\n#include <vector>\n#include <string>\n#include <unordered_set>\n\nusing namespace std;\n\nclass Solution {\npublic:\n    int numUniqueEmails(vector<string>& e
```\n#include <vector>\n#include <string>\n#include <unordered_set>\n\nusing namespace std;\n\nclass Solution {\npublic:\n    int numUniqueEmails(vector<string>& emails) {\n        unordered_set<string> res;\n\n        for (auto& str : emails) {\n            string sendto;\n            int i = 0;\n            while (str[i] != \'@\') {\n                if (str[i] == \'+\') {\n                    break;\n                }\n                if (str[i] != \'.\') {\n                    sendto.push_back(str[i]);\n                }\n                ++i;\n            }\n\n            int pos = str.find("@", i);\n            sendto += str.substr(pos);\n            res.insert(sendto);\n        }\n\n        return res.size();\n    }\n};\n\n#if DEBUG\nint main(int argc, char** argv) {\n    return 0;\n}\n#endif\n\n```
[]