P15101 [HackerEarth] Tech Families are an integral part of life @ VNIT. Dewang has quiet a few tech sons and daughters. His tech family is such that every person in his family can be represented by N relatio
普及
题目描述

Tech Families are an integral part of life @ VNIT. Dewang has quiet a few tech sons and daughters. His tech family is such that every person in his family can be represented by N relations.
A regular relation looks like this - /son1/son2/son3
/ operator is used here as the son of/daughter of operator.
The first / operator implies that the ultimate parent is Dewang. And so there is no need to mention his name in the relation. But Dewang is not satisfied with his small family. So now Dewang with his sons and daughters plan to increase their family tree. So they take interviews from first years for those who are worthy. After the interview they think of M relations that they want to implement. After such a long meeting Dewang is exhausted but he needs to find out how many adoptions are to be made so that all of the adoption relations are satisfied. Help Dewang count the number of adoptions.

NOTE: Adoption schemes are such that there might be some first year who will be adopting first years.

INPUT

First line of the Input file has an integer T which is the number of test cases. First line of each test case contains 2 integers N and M. Next N line contains all the relations that already exist in his tech family. Next M line contains M relations that are to be made.

OUTPUT

For every test case output a single integer which gives the value of adoptions that are to be made.

LIMITS

Every name in the relation follows the regular expression :[a-z0-9]

SAMPLE INPUT
2
0 2
/neha/shreya/anushree
/neha/shreya/shubham
2 1
/yogeshree
/yogeshree/radhika
/yogeshree

SAMPLE OUTPUT
4
0

输入格式

见题面

输出格式

见题面

样例输入
3 10 6 /home/vnit/techfest/crypto /home/visvesvaraya/techfest /home /home1/cipher /home2/xyz/insomnia /home1/pqr/answers /answers1/difficult /previous/unsolved/questions /home/output/final/testcases /hackerearth/easy/noquestions /home/vnit/aarohi /path/newfolder1/newfolder2/newfolder3 /home2/xyz/insomnia1/newquestions /home1/cipher1/problems /elims/cypher/crypto /home3/home2/xyz/insomnia 20 14 /home/vnit/techfest/crypto /home/visvesvaraya/techfest /home /home1/cipher /home2/xyz/insomnia /home1/pqr/answers /answers1/difficult /previous/unsolved/questions /home/output/final/testcases /hackerearth/easy/noquestions /lala/baba/bubli/bajrangibaba /bulbasaur/pokemon/beyblade/help /home/nit/vnit/axis /home/question1/answer/haha /home1/problems/temp/path /bulbasaur /pokemon1/pokemon2 /vnit/probs/nosolution /insomnia/problems/noproblem /ten/eleven/problems /insomnia/problems/noproblem /ten/eleven/problems /problems1/tough/easy /noidea/testcases/solution /noidea /vnit/nagpur /cities/nagpur /states /country/india/problems /home2/xyz/insomnia /home1/pqr/answers /answers1/difficult /home/patil/saxena/ /home1/srp/psp/shruti 50 6 /home/vnit/techfest/crypto /home/visvesvaraya/techfest /home /home1/cipher /home2/xyz/insomnia /home1/pqr/answers /answers1/difficult /previous/unsolved/questions /home/output/final/testcases /hackerearth/easy/noquestions /lala/baba/bubli/bajrangibaba /bulbasaur/pokemon/beyblade/help /home/nit/vnit/axis /home/question1/answer/haha /home1/problems/temp/path /bulbasaur /pokemon1/pokemon2 /vnit/probs/nosolution /insomnia/problems/noproblem /ten/eleven/problems /home/vnit/techfest/crypto /home/visvesvaraya/techfest /home /home1/cipher /home2/xyz/insomnia /home1/pqr/answers /answers1/difficult /previous/unsolved/questions /home/output/final/testcases /hackerearth/easy/noquestions /lala/baba/bubli/bajrangibaba /bulbasaur/pokemon/beyblade/help /home/nit/vnit/axis /home/question1/answer/haha /home1/problems/temp/path /bulbasaur /pokemon1/pokemon2 /vnit/probs/nosolution /insomnia/problems/noproblem /ten/eleven/problems /problems1/tough/easy /noidea/testcases/solution /noidea /vnit/nagpur /cities/nagpur /states /country/india/problems /home2/xyz/insomnia /home1/pqr/answers /answers1/difficult /home/vnit/aarohi /path/newfolder1/newfolder2/newfolder3 /home2/xyz/insomnia1/newquestions /home1/cipher1/problems /elims/cypher/crypto /home3/home2/xyz/insomnia
样例输出
16 19 16