#C5850. Total Unique Subscribers
Total Unique Subscribers
Total Unique Subscribers
You are given two lists of student roll numbers representing subscribers to two different newspapers: Web Dev Weekly and Data Science Monthly. Your task is to compute the total number of unique subscribers across both newspapers.
In mathematical terms, if W is the set of roll numbers for Web Dev Weekly and D is the set for Data Science Monthly, then you are to find \( |W \cup D| \), the size of their union.
The input is provided via standard input (stdin) and the output should be printed to standard output (stdout).
inputFormat
The input consists of four lines:
- The first line contains an integer ( n ), the number of subscribers of Web Dev Weekly.
- The second line contains ( n ) space‐separated integers representing the roll numbers for Web Dev Weekly.
- The third line contains an integer ( m ), the number of subscribers of Data Science Monthly.
- The fourth line contains ( m ) space‐separated integers representing the roll numbers for Data Science Monthly.
Note: When ( n=0 ) or ( m=0 ), the corresponding line may be empty.
outputFormat
Output a single integer to stdout representing the total number of unique subscribers across both newspapers.## sample
6
1 2 3 4 5 6
7
4 5 6 7 8 9 10
10