I am trying to see if every letter of the alphabet is used exactly once in a key to encrypt each letter of the alphabet. It would then store everything in a list, and once the list hits 26, exit the loop. I am having a bit of an issue achieving this (new to coding)
//check if all letters of the alphabet are in the key. Check if araay is in range a-z (already lowercase), if so, add it to list. return 1 if it is in the list.
//for each character in key:
// Create an array to store the letters of the key
if (c < 'a' || c > 'z') {
printf("String contains characters other than 'a' to 'z'.n");
return 0;
}
if (letters[c - 'a'] == 1) {
printf("String contains duplicate characters.n");
return 0;
}
letters[c - 'a'] = 1;
I have tried a few videos and articles but struggling to understand it if anyone can explain it /point me to good resources for it.
3