Symmetric Difference

  • + 0 comments
    n = int(input())
    a = set()
    a_initial_value = []
    a_initial_value = list(map(int, input().split()))
    for i in range(n):
        a.add(a_initial_value[i])
    
    m = int(input())
    b = set()
    b_initial_value = []
    b_initial_value = list(map(int, input().split()))
    for j in range(m):
        b.add(b_initial_value[j])
    
    
    a_difference = a.difference(b)
    b_difference = b.difference(a)
    ab_union = a_difference.union(b_difference)
    
    
    ab_union = list(ab_union)
    
    ab_union.sort()
    
    for k in ab_union:
        print(k)