-
Notifications
You must be signed in to change notification settings - Fork 0
/
804.cpp
28 lines (24 loc) · 807 Bytes
/
804.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
std::string password[26] = {".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....", "..", ".---", "-.-", ".-..", "--", "-.", "---", ".--.", "--.-", ".-.", "...", "-", "..-", "...-", ".--", "-..-", "-.--", "--.."};
int uniquePassword(std::vector<std::string>& words) {
int res = 0;
std::set<std::string> count;
std::string str;
for(auto& word : words) {
std::string temp ;
for(char& ch : word) {
temp += password[ch % 97];
}
count.insert(temp);
}
return count.size();
}
int main(int argc, char** argv) {
std::vector<std::string> words{"zocd", "gjkl", "hzqk", "hzgq", "gjkl"};
std::cout << uniquePassword(words) << std::endl;
return 0;
}