当前位置:网站首页>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();
}
};
运行结果

边栏推荐
- Importerror: libgl. so. 1: cannot open shared object file: no such file or directory
- Nat. Commun. | Knowledge integration and decision support for accelerating the discovery of antibiotic resistance genes
- Swift 3pThread tool Promise Pipeline Master/Slave Serial Thread confinement Serial queue
- Cap version 6.1 Release Notice
- 【AXI】解读AXI协议双向握手机制的原理
- 基于Feign远程调用
- Chongqing's first sci tech Innovation Board IPO is coming
- 运筹说 第64期丨动态规划奠基人——理查德·贝尔曼
- 当v-if和v-for需要同时使用的时候
- See how advanced technology changes human life
猜你喜欢

Gateway service gateway

Redis通用指令

大山深处的孩子,正在看见更远的星空
Redis operation set, Zset, hash data types and use of visualization tools

pands pd. Detailed parsing of dataframe() function

Swing visualization plug-in jformdesigner of idea

Gateway服务网关

Station B doesn't want to be a "conscience aiyouteng"

二十多年了,安全套市场还只有杜蕾斯、冈本、杰士邦

HTML+PHP+Mysql登录注册页面
随机推荐
目标客户匹配数据表格成功案例展示
【内容共创】第17期 夏日炎炎,有你超甜!参与签约华为云小编,花样礼包总有一款打动你!
【玩转华为云】手把手带你使用鲲鹏代码迁移工具实现源码迁移
Fabric. JS centered element
力扣 20. 有效的括号
2022年上海市安全员C证操作证考试题库模拟考试平台操作
自定义视图:图形与图像的处理(一):使用简单图片
For more than 20 years, there are only Durex, Okamoto and jasbon in the condom market
Set up proxy for chocolate
The children in the deep mountains are seeing the stars farther away
Why does the universe limit its maximum speed to the speed of light
2022年茶艺师(中级)操作证考试题库及模拟考试
Brands are difficult to establish, IPO is difficult, and Chinese tea enterprises are trapped in "tradition"?
Graduation season: to you
李飞飞:我更像物理学界的科学家,而不是工程师|深度学习崛起十年
Solve the problem that idea is stuck in opening a project
When V-IF and V-for need to be used at the same time
Facebook AI | 从数百万预测结构中学习逆向折叠
Xinsi technology helps Israel visuality systems promote the "left shift" of security
C#_ Serial port communication project