Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
1A#include <iostream> #include <cstdio> #define N 110 using namespace std; char s[N][N]; int main() { int n; char *c1, *c2; bool judge; int i, j, k; while(scanf("%d", &n)!=EOF && n!=0) { for(i=0; i<n; ++i) scanf("%s", s[i]); judge = true; for(k=0; judge; ++k) for(i=0; i<n; ++i) { if(s[i][k]=='\0' || !judge) { judge = false; break; } for(j=i+1; j<n; ++j) { c1 = &s[i][k]; c2 = &s[j][k]; if(strcmp(c1, c2) == 0) { judge = false; break; } } } printf("%d\n", k-2); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator