Pangrams

  • + 0 comments
    public static string pangrams(string s)
        {
            s = s.ToLower();
            
            int[] alphabet = new int[26];
            
            foreach(char c in s){
                if(c >= 'a' && c <='z'){
                    alphabet[(int)c - (int)'a']++;
                }
            }
    
            return alphabet.Any(c => c == 0) ? "not pangram" : "pangram";
        }