// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.Collections.Generic; using System.Linq; namespace NonRepChar { public class Program { public static void Main(string[] args) { string s = "Sunset glow on the horizon"; string s2 = String.Join("", s.Replace(" ", "").ToLower().ToCharArray() .GroupBy(c => c).Select(g => new { Key = g.Key, Count = g.Count() }) .Where(e => e.Count == 1).Select(e => e.Key)); Console.WriteLine(s2); } } }