Public submissions
Source code of every submission to this problem in this contest will be visible for everyone since 2015-11-29 19:30:00.
Problem hidden
This problem was hidden by Editorial Board member probably because it has incorrect language version or invalid test data, or description of the problem is not clear.

RGAME - The Game

Kubulu,subulu,bubulu are playing a game with words. Kubulu and subulu will randomly spell some words, bubulu will monitor their words and tell them how many words both of them spelled the same. As bubulu is not noting down the words in a paper  it's difficult for him to remember the unordered same words, so he will monitor the words which are following some order at the end he will tell the maximum words both of them spelled.  Kubulu and subulu don't repeat the words once they spelled. Why can't you help bubulu? since you have laptop.

NOTE: The words can be alphanumeric

Input format:

First line will have  number of testcase T (1<=T<=100).

second line will have no of words spelled by subulu (1<=N<=10000) and no of words spelled by kubulu(1<=M<=10000).

Next N lines will have the words spelled by subulu. Length of the each word is in between 1 to 10000000.

Next M lines will have the words spelled by kubulu. Length of the each word is in between 1 to 10000000.

 

Output

Output the maximum words both of them spelled the same.

Example

Input:
2

4 3

hari
suren
sathya
rajagopal

rajagopal
suren
sathya

4 5
aaa
bbb
cccc
ddd

bbb
aaa
cccc
eeee
ddd


 Output: 2

3

Note : Blank lines are for clarity.


Explanation :
suren,sathya,  rajagopal are the only same words but suren and sathya follows an order. 
Edit:

The order of words should be in increasing order.

Added by:Noob
Date:2015-11-28
Time limit:0.5s-3s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64 MAWK BC NCSHARP COFFEE DART FORTH GOSU JS-MONKEY JULIA KTLN OCT PROLOG PYPY3 R RACKET SQLITE SWIFT UNLAMBDA
Public source code since: 2015-11-29 19:30:00

hide comments
2015-11-29 16:59:07 Manioz3544
Am unable to use unordered_map it shows error but if I use map its a TLE whats the prb ??
2015-11-28 18:30:39 Noob
Yes typo!
2015-11-28 18:30:34 Prabhakaran
only one testcase is there
2015-11-28 18:28:29 vb
T must be 1 in sample input right.
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.