File tree Expand file tree Collapse file tree
LeetCode/Unique_Email_Addresses Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #include < bits/stdc++.h>
2+ #include < gtest/gtest.h>
3+ using namespace std ;
4+
5+
6+ // // START
7+ /*
8+ ## Unique Email Addresses
9+
10+ */
11+ class Solution {
12+ public:
13+ int numUniqueEmails (vector<string>& emails) {
14+ unordered_set<string> ss;
15+ for (string email: emails){
16+ string str;
17+ bool inDomain=false ;
18+ bool plus = false ;
19+ for (char c : email){
20+ if (inDomain){
21+ str.push_back (c);
22+ }else if (c == ' @' ){
23+ inDomain = true ;
24+ str.push_back (c);
25+ }else if (c == ' +' ){
26+ plus = true ;
27+ }else if (plus || c == ' .' ){
28+ continue ;
29+ }else {
30+ str.push_back (c);
31+ }
32+ }
33+ ss.insert (str);
34+ }
35+ return ss.size ();
36+ }
37+
38+ };
39+
40+
41+
42+ // // END
43+ struct T {
44+
45+ };
46+
47+ TEST (Solution,test){
48+ T ts[] = {
49+ {
50+
51+ },
52+ {
53+
54+ },
55+
56+ };
57+
58+
59+ for (T t : ts){
60+ Solution solution;
61+
62+ }
63+ }
64+
65+ int main () {
66+ testing::InitGoogleTest ();
67+
68+ return RUN_ALL_TESTS ();
69+ }
70+
71+
You can’t perform that action at this time.
0 commit comments