比赛 暑假培训B班二测 评测结果 AWAAAAAAAA
题目名称 牛棚回声 最终得分 90
用户昵称 digital-T 运行时间 0.001 s
代码语言 Pascal 内存使用 0.17 MiB
提交时间 2012-07-22 10:09:51
显示代码纯文本
  1. var
  2. a,b:string;
  3. i,j,k,l,big,head,tail:integer;
  4. begin
  5. assign(input,'echo.in');reset(input);
  6. assign(output,'echo.out');rewrite(output);
  7. readln(a);
  8. read(b);
  9. big:=0;
  10.  
  11. for i:=1 to length(a) do
  12. for j:=1 to length(b) do
  13. if a[i]=b[j] then
  14. begin
  15. k:=1;
  16. head:=i;
  17. tail:=j;
  18. while (a[head+1]=b[tail+1])and(head<length(a))and(tail<length(b))do
  19. begin
  20. inc(k);
  21. inc(head);
  22. inc(tail);
  23. end;
  24. if (i=1)or(tail=length(b)) then if k>big then big:=k;
  25. end;
  26.  
  27. write(big);
  28.  
  29. close(input);
  30. close(output);
  31. end.