I have a website which allows users to comment on photos. Of course, users leave comments like:
\'OMGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
var test = "OMMMMMGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGMMM"; test.Distinct().Select(c => c.ToString()).ToList() .ForEach(c => { while (test.Contains(c + c)) test = test.Replace(c + c, c); } );