给出两个字符串(可能包含空格),找出其中最长的公共连续子串,输出其长度

题目介绍

给出两个字符串(可能包含空格),找出其中最长的公共连续子串,输出其长度。

输入描述:
输入为两行字符串(可能包含空格),长度均小于等于50.


输出描述:
输出为一个整数,表示最长公共连续子串的长度。


输入例子1:
abcde
abgde


输出例子1:
2

源代码

#include
#include
 
using namespace std;
 
int main()
{
    string a,b;
    getline(cin,a);
    getline(cin,b);
    int maxlen=0;
    if(a.empty()||b.empty()) cout<<0<

你可能感兴趣的:(LeetCode)