You are viewing a single comment's thread. Return to all comments →
java
public static String pangrams(String s) { HashMap<Character,Character> alphabet = new HashMap<>(); IntStream.rangeClosed('a', 'z').mapToObj(c -> (char)c).forEach(c -> alphabet.put(c, '0')); int counter = alphabet.size(); for(int i = 0; i < s.length(); i++){ char character = Character.toLowerCase(s.charAt(i)); if(alphabet.containsKey(character) && alphabet.get(character) == '0'){ alphabet.put(character, '1'); counter--; } } return counter == 0 ? "pangram" : "not pangram"; }
Seems like cookies are disabled on this browser, please enable them to open this website
Pangrams
You are viewing a single comment's thread. Return to all comments →
java