// Problem#: 1426
// Submission#: 1663136
// The source code is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
// URI: http://creativecommons.org/licenses/by-nc-sa/3.0/
// All Copyright reserved by Informatic Lab of Sun Yat-sen University
//1426
#include <iostream>
#include <algorithm>
#include <string>
#include <cstdio>
using namespace std;
bool cmp(string a, string b)
{
return a < b;
}
int main()
{
int t;
cin >> t;
while (t--)
{
string str[10001];
int n;
bool sign = true;
cin >> n;
char s[100];
for (int i = 0; i < n; i++)
{
scanf ("%s",&s);
str[i]=s;
}
//cin >> str[i];
sort(str,str+n,cmp);
for (int j = 1; j < n; j++)
{
if (str[j-1].size() > str[j].size())
{
continue;
}
else
{
string temp = str[j].substr(0,str[j-1].size());
if (temp == str[j-1])
{
sign = false;
}
}
}
if (sign)
printf ("YES\n");//cout << "YES" << endl;
else
printf ("NO\n");
}
return 0;
}
sicily 1426 Phone List
最新推荐文章于 2019-08-17 09:31:27 发布