Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution {
- public:
- int numUniqueEmails(vector<string>& emails) {
- unordered_set<string> st;
- for(string &email : emails) {
- string cleanEmail;
- for(char c : email) {
- if(c == '+' || c == '@') break;
- if(c == '.') continue;
- cleanEmail += c;
- }
- cleanEmail += email.substr(email.find('@'));
- st.insert(cleanEmail);
- }
- return st.size();
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment