• + 0 comments

    f# solution

    open System
    
    let getCount key s =
        match Seq.tryFind (fun (k, _) -> k = key) s with
        | Some(_, values) -> Seq.length values
        | None -> 0
    
    let _ = Console.ReadLine()
    let left = Console.ReadLine() |> (fun s -> s.Split(" "))
    let _ = Console.ReadLine()
    let right = Console.ReadLine() |> (fun s -> s.Split(" "))
    
    let groupLeft = left |> Seq.groupBy id
    let groupRight = right |> Seq.groupBy id
    
    Seq.append left right
    |> Seq.distinct
    |> Seq.filter (fun key ->
        (getCount key groupLeft) <> getCount key groupRight)
    |> List.ofSeq
    |> Seq.sort
    |> String.concat " "
    |> Console.WriteLine