【Leetcode_easy】929. Unique Email Addresses

时间:2024-11-09 20:05:20

problem

929. Unique Email Addresses

solution:

class Solution {
public:
int numUniqueEmails(vector<string>& emails) {
unordered_set<string> tmp;
for(auto email:emails)
{
std::size_t at = email.find('@');
string local = "";
for(int i=; i<at; i++)
{
if(email[i]=='.') ;
else if(email[i]=='+') break;
else local += email[i];
}
tmp.insert(local+'@'+email.substr(at+));//errr...
}
return tmp.size();
}
};

参考

1. Leetcode_easy_929. Unique Email Addresses;