Longest Common Substring

easy
1.Given two strings X and Y. The task is to find the length of the longest common substring.
 2.You have to complte the function lcs() which shoulld return an Integer

Input Format

1.First line contains two space separated integers 'N' and 'M' denoting the size of two strings. 2.Next two lines contains two strings

Output Format

Return an Integer

Constraints

1 <= N, M <= 100

Notice

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

Example

Input
6 6
ABCDGH
ACDGHR
Output
4
Previous
Longest Common Subsequence
Next
Longest Increasing Subsequence

Related Questions