using System.Collections.Generic;
public static void Main()
bool isPangram = Inova.IsPangram("abcdefghijklmnopqrstuvwxyZZ", true);
Console.WriteLine("Is perfect pangram? " + isPangram);
isPangram = Inova.IsPangram("abcdefghijklmnopqrstuvwxyZZ", false);
Console.WriteLine("Is imperfect pangram? " + isPangram);
public static class Inova
private const string alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
public static bool IsPangram(string str, bool mustBePerfect)
HashSet<char> remaingLetters = new HashSet<char>(alphabet);
char letter = char.ToUpperInvariant(c);
if (!alphabet.Contains(letter)) continue;
bool repeatingLetter = !remaingLetters.Remove(letter);
if (mustBePerfect && repeatingLetter)
return remaingLetters.Count == 0;