**Physical Address**

304 North Cardinal St.

Dorchester Center, MA 02124

Given 2 sets of integers, M and N, print their symmetric difference in ascending order. The term symmetric difference indicates those values that exist in either M or N but do not exist in both.

The first line of input contains an integer, M.

The second line contains M space-separated integers.

The third line contains an integer, N.

The fourth line contains N space-separated integers.

Output the symmetric difference integers in ascending order, one per line.

**4**
**2** **4** **5** **9**
**4**
**2** **4** **11** **12**

**5**
**9**
**11**
**12**

```
n=int(raw_input())
my=set(map(int,raw_input().split()))
m=int(raw_input())
my2=set(map(int,raw_input().split()))
for i in sorted(my.union(my2)):
if i not in my.intersection(my2):
print i
```

```
# Enter your code here. Read input from STDIN. Print output to STDOUT
a,b = [set(input().split()) for _ in range(4)][1::2]
print('\n'.join(sorted(a^b, key=int)))
```

```
# Enter your code here. Read input from STDIN. Print output to STDOUT
M = int(raw_input())
A = set(map(int, raw_input().split()))
N = int(raw_input())
B = set(map(int, raw_input().split()))
l = sorted((A.difference(B)).union(B.difference(A)))
print "\n".join([str(element) for element in l])
```

```
# Enter your code here. Read input from STDIN. Print output to STDOUT
m = int(input())
set1 = set(list(map(int, input().split())))
n = int(input())
set2 = set(list(map(int, input().split())))
#print (set1)
#print (set2)
n1 = set1.difference(set2)
n2 = set2.difference(set1)
L = [str(x) for x in n1] + [str(x) for x in n2]
L.sort(key = int)
#print (L)
print ('\n'.join(L))
```

In our experience, we suggest you solve this Symmetric Difference Hacker Rank Solution and gain some new skills from Professionals completely free and we assure you will be worth it.

Symmetric Difference problem is available on Hacker Rank for Free, if you are stuck anywhere between a compilation, just visit Queslers to get Symmetric Difference Hacker Rank Solution

I hope this Symmetric Difference Hacker Rank Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Hacker Rank, Leetcode, Codechef, Codeforce Solution.

This Problem is intended for audiences of all experiences who are interested in learning Programming in a business context; there are no prerequisites.

Keep Learning!

**More Hacker Rank Problem & Solutions >>**

Staircase Hacker Rank Solution

A Very Big Sum Hacker Rank Solution

Diagonal Difference Hacker Rank Solution