링크 : https://school.programmers.co.kr/learn/courses/30/lessons/42577
#include <string>
#include <vector>
#include <unordered_map>
using namespace std;
bool solution(vector<string> phone_book) {
unordered_map<string, int> hash;
for(int i = 0; i < phone_book.size(); i++){
hash[phone_book[i]] = 1;
}
for (int i = 0; i < phone_book.size(); i++){
for (int j = 0; j < phone_book[i].size() - 1; j++){
string phone_number = phone_book[i].substr(0, j + 1);
if (hash[phone_number]) return false;
}
}
return true;
}