比赛 20091103 评测结果 AAAAAAAAAA
题目名称 牛棚回声 最终得分 100
用户昵称 Hamster 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2009-11-03 08:59:44
显示代码纯文本
program echo;
var
  r1,r2:string;
  i,j,i1,i2,max,l1,l2:longint;
begin
  assign(input,'echo.in');
  assign(output,'echo.out');
  reset(input);
  rewrite(output);
  
  readln(r1);
  readln(r2);
  l1:=length(r1);
  l2:=length(r2);
  for i:=l2 downto 1 do
  begin
    i1:=1;
	i2:=i;
	while (r1[i1]=r2[i2]) and (i2<l2) and (i1<=l1) do
	begin
	  inc(i1);
	  inc(i2);
	end;
	if i1>max then max:=i1;
  end;
  
  for i:=l1 downto 1 do
  begin
    i2:=1;
	i1:=i;
	while (r1[i1]=r2[i2]) and (i1<l1) and (i2<=l2) do
	begin
	  inc(i2);
	  inc(i1);
	end;
	if i2>max then max:=i2;
  end;
  write(max);
  
  
  close(input);
  close(output);
end.