blob: d23ed9d3c302fa30193719a3ea2b0b741f936006 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
#include "pangram.h"
#include <ctype.h>
#include <string.h>
bool is_pangram(const char *sentence) {
if (sentence == NULL) return false;
bool seen[26] = {0};
for (size_t idx = 0; sentence[idx] != '\0'; idx++) {
unsigned char cur = tolower((unsigned char) sentence[idx]);
if ('a' <= cur & cur <= 'z') seen[cur - 'a'] = true;
}
for (short idx = 0; idx < 26; idx++)
if (!seen[idx]) return false;
return true;
}
|