Pangrams

Sort by

recency

|

405 Discussions

|

  • + 0 comments
        public static String pangrams(String s) {
        // Write your code here
            var letters = s.chars()
                .filter(c -> Character.isAlphabetic(c))
                .map(c -> Character.toLowerCase(c))
                .mapToObj(c -> c)
                .collect(Collectors.toSet());
            
            return letters.size() == 26 ? "pangram" : "not pangram";
        
    
  • + 0 comments

    Python

    def pangrams(s):
        alphabet={}
        for i in s.lower():
            if i.isalpha() and i in alphabet:
                alphabet[i]+=1
            elif i.isalpha() and i not in alphabet:
                alphabet[i]=0
        
        if len(alphabet)==26:
            return  "pangram"
        else:
            return "not pangram"
    
  • + 0 comments

    //Swift

    func pangrams(s: String) -> String { // Write your code here var set: Set = []

    for char in s {
        set.insert(char.lowercased())
    }
    
    set.remove(" ")
    if set.count == 26 {
        return "pangram"
    } else {
        return "not pangram"
    }
    

    }

  • + 0 comments

    def pangrams(s): # Write your code here pre_str=s.strip() pre_str=pre_str.replace(' ','') pre_str=pre_str.lower() alpha=set(pre_str) if len(alpha)<26 : return 'not pangram' else: return "pangram"

  • + 0 comments

    function pangrams(s) { let loverCaseString = s.toLowerCase(); const regex = /[a-zA-Z]/g; let pangrams = loverCaseString.match(regex); let uniqueChars = [... new Set(pangrams)]; return uniqueChars.length === 26 ? 'pangram' : 'not pangram'; }