FACEFRND  Friends of Friends
Bob uses a social networking site almost all the time. He was wondering what are Friends of Friends in that social networking site? If “X” is his friend, and “Y” is X’s friend but “Y” is not his friend, then “Y” is called his friend of friend. You have to find how many friends of friends Bob has. (Each user in that social networking site has a unique 4digit ID number)
Input
First line contains a integer “N” (1 <= N <= 100) the number of friends in Bob's Profile. Then follow N lines.
First Integer in each line is the ID number of Bob's friend, then an integer “M” (1 <= M <= 100) is the number of people in his friend list. Then follow M integers in that line, denoting the ID number of friends in his friend list (excluding Bob).
Output
Output a single integer denoting Bob's number of friends of friends.
Example
Input: 3 2334 5 1256 4323 7687 3244 5678 1256 2 2334 7687 4323 5 2334 5678 6547 9766 9543 Output: 6
hide comments
kumar_anubhav:
20200627 13:45:08
Ac in one go!! cake piece :) 

adikrmishra_1:
20200519 16:42:33
AC in one go :) use STL set 

jrishabh720:
20200516 17:54:09
AC in one go using set :) 

dylanthomas:
20200126 15:16:32
for all those getting AC in one go, please send your resume to NASA. You have been selected for the next Mars mission. 

cheersanimesh:
20191026 23:12:39
AC in one go using map 0.00 

roni_roy18:
20190601 09:17:49
Very easy using set :) 

masterchef2209:
20180810 16:12:19
simple problem,becomes super easy with stl sets; 

vkash:
20180713 19:54:33
A piece of cake!! 

kkislay20:
20180617 14:52:02
Can be done using a single array also. Cakewalk!! 

vivek_dwivedi:
20180615 22:02:27
one set ! thats it .. do it when u r boared! ;)

Added by:  Ankit Kumar Vats 
Date:  20111020 
Time limit:  1s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All 
Resource:  Own Problem 