• + 0 comments

    Java solution:

    public static String pangrams(String s) {
        // Write your code here
            String alpha = "abcdefghijklmnopqrstuvwxyz";
            Set<Character> alphaSet = alpha.chars()
                                        .mapToObj(c -> (char)c)
                                        .collect(Collectors.toSet());
            Set<Character> givenSet = s.replaceAll("\\s", "").toLowerCase().chars()
                                        .mapToObj(c -> (char)c)
                                        .collect(Collectors.toCollection(TreeSet::new));
            return givenSet.equals(alphaSet) ? "pangram" : "not pangram";       
        }