fork download
  1. #include <stdio.h>
  2.  
  3. int is_panggram(const char *str) {
  4. char ch;
  5. int present = 0;
  6. int result = 0;
  7. int x;
  8. while (ch = *str++) {
  9. if(ch > 'z') return 0;
  10. else if(ch >= 'a') x = 1<<(ch - 'a');
  11. else if(ch >= 'A') x = 1<<(ch - 'A');
  12. else return 0;
  13. if(x & present == x) continue;
  14. else present |= x;
  15. result |= x;
  16. }
  17. return 0x3ffffff == result;
  18. }
  19.  
  20. int main() {
  21. printf("%d\n", is_panggram("ABBBBBCDEFghijklmnopqrstuvwxyZ"));
  22. printf("%d\n", is_panggram("abdefghijklmopqrstuvwxyz"));
  23. }
Success #stdin #stdout 0s 10320KB
stdin
Standard input is empty
stdout
1
0