Sorry, can anyone help me please. Here is my submission for problem 427D: http://codeforces.net/contest/427/submission/26701755. I got WA on test 17 and can't understand why. My solution:
f[i][j]: longest common string end at s1[i] and s2[j];
f1[i][j]: longest common string end at s1[i] and s1[j];
f2[i][j]: longest common string end at s2[i] and s2[j];
max1[i]: longest common string end at i with all position j in s1 except i.
max2[i]: longest common string end at i with all position j in s2 except i.
Then for all pair(i, j) have f[i][j] > max(max1[i], max2[j]): i update answer;