package com.thealgorithms.strings;
public class Pangram {
public static void main(String[] args) {
assert isPangram("The quick brown fox jumps over the lazy dog");
assert !isPangram("The quick brown fox jumps over the azy dog");
assert !isPangram("+-1234 This string is not alphabetical");
assert !isPangram("\u0000/\\");
}
public static boolean isPangram(String s) {
boolean[] lettersExisting = new boolean[26];
for (char c : s.toCharArray()) {
int letterIndex = c - (Character.isUpperCase(c) ? 'A' : 'a');
if (letterIndex >= 0 && letterIndex < lettersExisting.length) {
lettersExisting[letterIndex] = true;
}
}
for (boolean letterFlag : lettersExisting) {
if (!letterFlag) {
return false;
}
}
return true;
}
}