시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB61423967.241%

## 문제

Bessie's friend Jessie wanted to enter a programming contest. "What are the tasks like?" she asked.

Bessie, known to be knowledgeable about so many things, said "Here is a typical problem that folks solve early in their competitive career. See if you can solve it."

Perhaps you can solve it, too.

You are given two sequences of integers, S1 and S2. S1 has length L1 (1 <= L1 <= 180) and S2 has length L2 (1 <= L2 <= 180). Your job is to print out the length of the longest contiguous subsequence of numbers common to both S1 and S2. Ordered sequence S1 has elements S1_1, S1_2, ..., S1_L1 (-100 <= S1_i <= 100); S2 has elements S2_i (-100 <= S2_i <= 100).

A contiguous subsequence is a consecutive run of numbers in that sequence. The subsequences of 1 2 3 1 are: the empty sequence, "1", "1 2", "1 2 3", "1 2 3 1", "2", "2 3", "2 3 1", "3", "3 1", and a repeat occurrence of "1".

## 입력

• Line 1: Two space-separated integers: L1 and L2
• Lines 2..L1+1: Line i+1 contains a single integer: S1_i
• Lines L1+2..L1+L2+1: Line L1+i+1 contains a integer: S2_i

## 출력

• Line 1: A single integer, the length of the longest contiguous subsequence of S1 and S2

## 예제 입력 1

10 12
1
1
1
3
2
3
3
3
4
5
1
1
1
1
3
2
3
3
4
4
5
-8


## 예제 출력 1

7


## 힌트

Corresponds to the contiguous subsequence 1,1,1,3,2,3,3.

## 출처

• 문제의 오타를 찾은 사람: kcm1700