Ad
Code
Diff
  • using System;
    using System.Linq;
    
    public class Kata
    {
          public static int DuplicateCount(string str)
          {
                return str
                    .ToLower()
                    .GroupBy(c => c)
                    .Count (g => g.Count () > 1);
          }
    }
    • using System;
    • using System.Linq;
    • public class Kata
    • {
    • public static int DuplicateCount(string str)
    • {
    • return str
    • .ToLower()
    • .GroupBy(c => c)
    • .Aggregate(0, (current, next) => current + (next.Count() > 1 ? 1 : 0));
    • .Count (g => g.Count () > 1);
    • }
    • }