PANGRAM STRING OR NOT from Hackerrank.com
https://www.hackerrank.com/challenges/pangrams/problem
Pangrams are sentences constructed by using every letter of the alphabet at least once.
[restrict …]
#include<stdio.h> #include <stdlib.h> char* pangrams(char* s) { int i; char ch; int found = 0; int count = 0; static char s1[]="pangram"; static char s2[]="not pangram"; for(i=0;s[i];i++) { if((s[i] >= 65) && (s[i] <= 90)) s[i] = s[i] +32; } ch = 'a'; while(ch <= 'z') { for(i=0;s[i];i++) { if(s[i] == ch) { found = 1; count++; break; } } if(found == 0) return s1; ch++; } if(count == 26) return s1; else return s2; } int main() { char s1[]="We promptly judged antique ivory buckles for the next prize"; printf("%s\n",pangrams(s1)); return 0; }
[/restrict]