当前位置:网站首页>Leetcode 929. 独特的电子邮件地址
Leetcode 929. 独特的电子邮件地址
2022-06-10 16:51:00 【JackDawn!?】
题目

思路
按照题意简单模拟即可。
代码
class Solution {
public:
int numUniqueEmails(vector<string>& emails) {
set<string> s;
for(auto ss: emails) {
bool flag = true;
string str = "";
char ch;
for(int i = 0; i < ss.size(),ch=ss[i]; ++i) {
if(ch == '@') flag = false;
if(flag) {
if(ch == '+') {
while(ch != '@') {
ch = ss[++i];
}
--i;
flag = false;
continue;
} else if(ch == '.') {
continue;
}
}
str += ch;
}
s.insert(str);
/* printf("%s\n", str.c_str()); */
}
return s.size();
}
};
运行结果

边栏推荐
猜你喜欢

2022年T电梯修理考试题模拟考试题库及在线模拟考试

pands pd.DataFrame()函数详细解析

Nacos注册中心

虚拟机ping不通的几种原因及解决办法

Mapbox GL development tutorial (11): loading line layers

5年后,你将如何融入20万亿美元的「项目经济」

It has become a unicorn since its establishment one year ago. Tencent didi is the "backer". This year's new unicorn is not simple

Nacos配置管理

Numpy np set_ Usage of printoptions () -- control output mode

Penguin E-sports stops, and tiger teeth are hard to walk
随机推荐
It has become a unicorn since its establishment one year ago. Tencent didi is the "backer". This year's new unicorn is not simple
Swift 3pThread tool Promise Pipeline Master/Slave Serial Thread confinement Serial queue
聊聊消息中间件(1),AMQP那些事儿
2022年茶艺师(中级)操作证考试题库及模拟考试
蓝桥杯_糊涂人寄信_递归
新思科技在《 2022 年 Gartner 应用安全测试关键能力报告》中表现优异 在五个常见用例中荣获最高分
Draw confusion matrix
vscode常用快捷键
Solve the problem that idea is stuck in opening a project
com.netflix.client.ClientException: Load balancer does not have available server for client: userser
For more than 20 years, there are only Durex, Okamoto and jasbon in the condom market
See how advanced technology changes human life
Photoshop如何打开、编辑和导出Webp格式图片的方法
Swing visualization plug-in jformdesigner of idea
[play with Huawei cloud] Kunpeng devkit migration practice
【抬杠C#】如何实现接口的base调用
《华为数据之道》读书笔记
Fabric.js 缩放画布
Fabric. JS zoom canvas
What should be done to improve the service level of the park and optimize the business environment