2 solutions
-
0
Guest MOD
-
0
#include<cstdio> #include<cstring> #include<iostream> #include<algorithm> #define N 1017 using namespace std; int n,m; char s[N][N]; int main() { cin >> n >> m; for(int i = 1;i <= n;i += 1)cin >> s[i]+1; int ans = 0; for(int i = 2;i <= n;i += 1){ int x = strlen(s[i-1]+1),y = strlen(s[i]+1); int len = 0; while(s[i-1][x] == s[i][y] && x >= 1 && y >= 1)x--,y--,len++; ans = max(ans,len); } cout << ans << endl; return 0; }
- 1
Information
- ID
- 303
- Time
- 1000ms
- Memory
- 512MiB
- Difficulty
- 4
- Tags
- (None)
- # Submissions
- 49
- Accepted
- 25
- Uploaded By