Problem 21813 --See LCS again

## 21813: See LCS again

Time Limit: 1 Sec  Memory Limit: 64 MB
Submit: 28  Solved: 11
[Submit][Status][Web Board][Creator:][下载FPS1元][添加到购物车][下载测试数据1元][752kb]

## Description

There are A, B two sequences, the number of elements in the sequence is n、m;

Each element in the sequence are different and less than 100000.

Calculate the length of the longest common subsequence of A and B.

## Input

The input has multicases.Each test case consists of three lines;
The first line consist two integers n, m (1 < = n, m < = 100000);
The second line with n integers, expressed sequence A;
The third line with m integers, expressed sequence B;

## Output

For each set of test cases, output the length of the longest common subsequence of A and B, in a single line.

## Sample Input

5 4
1 2 6 5 4
1 3 5 4


## Sample Output

3


[Submit][Status]