#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
bool cmp(string A, string B){
return A < B;
}
bool solution(vector<string> phone_book) {
bool answer = true;
// cout << (phone_book[0] < phone_book[2]);
sort(phone_book.begin(), phone_book.end(), cmp);
for(int i = 0; i< phone_book.size()-1;i++){
if(phone_book[i+1].length() <= phone_book[i].length()) continue;
if(phone_book[i+1].find(phone_book[i])==0)
return false;
// cout << phone_book[i+1].find(phone_book[i]) << ' ';
}
// cout << phone_book[i] <<' ';
return true;
}
카테고리 없음