I need help to find if a 2D char array is a pangram in c

Solution 1:

  1. Pangram :
    A pangram or holoalphabetic sentence is a sentence using every letter of a given alphabet at least once. Pangram - wiki

2. Count only unique appearance of letters in the input words. Words can have both upper & lower case letters.

#include <stdio.h>
#include <string.h>
#include <ctype.h>

#define MAX_INPUT_WORDS 10
#define MAX_WORD_SIZE   50
#define UNIQUE_LETTERS  26

int main()
{
    char* uniq_chars = "abcdefghijklmnopqrstuvwxyz";
    //create a look-up table for characters in an alphabet set
    char alpha_lt[256] = {0};
    for (int ai = 0; '\0' != uniq_chars[ai]; ++ai)
        alpha_lt[ (unsigned) uniq_chars[ai]] = 1;

    char words [MAX_INPUT_WORDS][MAX_WORD_SIZE];

    printf ("\nEnter up to 10 words, try to make a Pangram:\n");
    int uniq_count = 0; // tracks count of unique characters so far
    int wcount = 0;
    for (int wi = 0 ; wi < MAX_INPUT_WORDS; ++wi) {
        while (1 != scanf ("%49s", words[wi]));
        ++wcount;
        //count the unique characters from alphabet-set
        for (int ci = 0; '\0' != words[wi][ci]; ++ci) {
            //Pangram can have letter from different cases.
            int ichar = tolower (words[wi][ci]); // to homogenise upper/lower cases
            if (alpha_lt[ichar]) {    // uniq character not yet counted
                ++uniq_count;
                alpha_lt[ichar] = 0; // remove from LT; to skip
                // counting during next occurance
            }
        }
        if (UNIQUE_LETTERS == uniq_count)
            break;
    }

    printf ("\nIs it a Pangram?\n");
    printf ((UNIQUE_LETTERS == uniq_count) ? "Yes!\n" : "No\n");
    for (int wi = 0; wi < wcount;)
        printf ("%s ", words[wi++]);
    printf ("\n");

    return 0;
}
  1. Sample Pangrams for standard English:
"Waltz, bad nymph, for quick jigs vex." (28 letters)  
"Glib jocks quiz nymph to vex dwarf." (28 letters)  
"Sphinx of black quartz, judge my vow." (29 letters)  
"How vexingly quick daft zebras jump!" (30 letters)  
"The five boxing wizards jump quickly." (31 letters)  
"Jackdaws love my big sphinx of quartz." (31 letters)  
"Pack my box with five dozen liquor jugs." (32 letters)  
"The quick brown fox jumps over a lazy dog" (33 letters)  

Invalid Pangrams for testing:

ABCD EFGH IJK LMN OPQR STUVWXY Z  
abcdef g h i jklmnopqrstuvwxyz