标签:style blog http color java os io for ar
2 3 ABCD BCDFF BRCD 2 rose orchid
2 2
1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 #include <cmath> 5 #include <algorithm> 6 #include <climits> 7 #include <vector> 8 #include <queue> 9 #include <cstdlib> 10 #include <string> 11 #include <set> 12 #include <stack> 13 #define LL long long 14 #define pii pair<int,int> 15 #define INF 0x3f3f3f3f 16 using namespace std; 17 string str[110]; 18 int main() { 19 int t,i,j,k,n; 20 bool flag; 21 scanf("%d",&t); 22 while(t--){ 23 scanf("%d",&n); 24 for(i = 0; i < n; i++) 25 cin>>str[i]; 26 sort(str,str+n); 27 flag = false; 28 for(k = str[0].length(); k; k--){ 29 for(i = 0; i + k <= str[0].length(); i++){ 30 string a = str[0].substr(i,k); 31 string b(a.rbegin(),a.rend()); 32 for(j = 1; j < n; j++) 33 if(str[j].find(a) == -1 && str[j].find(b) == -1) break; 34 if(j == n) {flag = true;break;} 35 } 36 if(flag) break; 37 } 38 flag?printf("%d\n",k):puts("0"); 39 } 40 return 0; 41 }
标签:style blog http color java os io for ar
原文地址:http://www.cnblogs.com/crackpotisback/p/3931725.html