LCS - Longest Common Substring

题意翻译

输入两个字符串,输出它们的最长公共子串长度,若不存在公共子串则输出 $0$。 其中字符串长度不超过 $2.5\times 10^5$。

题目描述

A string is finite sequence of characters over a non-empty finite set Σ. In this problem, Σ is the set of lowercase letters. Substring, also called factor, is a consecutive sequence of characters occurrences at least once in a string. Now your task is simple, for two given strings, find the length of the longest common substring of them. Here common substring means a substring of two or more strings.

输入输出格式

输入格式


The input contains exactly two lines, each line consists of no more than 250000 lowercase letters, representing a string.

输出格式


The length of the longest common substring. If such string doesn't exist, print "0" instead.

输入输出样例

输入样例 #1

alsdfkjfjkdsal
fdjskalajfkdsla

输出样例 #1

3