| 记录编号 | 41427 | 评测结果 | AAAAAAAAAA | 
    
        | 题目名称 | 393.[USACO Oct09] 牛棚回声 | 最终得分 | 100 | 
    
        | 用户昵称 |  yuan | 是否通过 | 通过 | 
    
        | 代码语言 | C++ | 运行时间 | 0.003 s | 
    
        | 提交时间 | 2012-07-22 21:13:26 | 内存使用 | 0.32 MiB | 
    
    
    
    		显示代码纯文本
		
		#include <fstream>
#include <string>
using namespace std;
ifstream fin("echo.in");
ofstream fout("echo.out");
int maxlen=0;
int ifecho(string a,string b)//验证a串的前缀是否是b串的后缀
{
	int m,n;
	m=a.length();
	n=b.length();
	while(m>0&&m>maxlen)
	{
		if(n>=m&&a.substr(0,m)==b.substr(n-m,m))
		{
			if(m>maxlen)maxlen=m;
		}
		m--;
	}
	return 0;
}
int main()
{
	string s="",t="";
	fin>>s>>t;
	ifecho(s,t);
	ifecho(t,s);
	fout<<maxlen<<endl;
	fin.close();
	fout.close();
	return 0;
}