using System; using System.Linq; using System.Collections.Generic; public class Test { public static void Main() { var a = new List{"A","A", "B", "C"}; var b = new List{"A", "B"}; var res = a.Select(e => new {Key=e, Val=1}) .Concat(b.Select(e => new {Key=e, Val=-1})) .GroupBy(e => e.Key, e => e.Val) .SelectMany(g => Enumerable.Repeat(g.Key, Math.Max(0, g.Sum()))) .ToList(); foreach (var e in res) { Console.WriteLine(e); } } }