Longest Common Substring II

SPOJ - LCS2