 C++ Sets
##### Submissions: 522   Accuracy: 14.7%   Difficulty: Basic   Marks: 1

Write a program to perform set operation i.e union, intersection and difference on sets using set_union, set_difference and set_intersection functions of STL.
Input:
The first line of the input contains T denoting the number of test cases. For each test case, the first line takes 2 integer input m & n denoting the size of the two sets A & B. The next line contains m space separated integers of set A, followed by n-space separated integers of set B.

Output:
For each test case, the output is the set union(A U B), the difference(A-B) and the intersection of the two sets A & B, each in a new line and if no element present after the operation, output is 0.

Constraints:
1<=T<=100
1<=n,m<=50
Example:
Input

1
4 5
1 2 3 4
3 4 5 6 7
Output:
1 2 3 4 5 6 7
1 2
3 4

Explanation:
Union of two sets A i.e (1 2 3 4) and B i.e(3 4 5 6 7) is 1 2 3 4 5 6 7.
Difference i.e A-B is 1 2.
The intersection is 3 4.

#### ** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Vanshika
Author: Vanshika_pec

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.