fork download
  1. #include <stdio.h>
  2.  
  3. f(char*s){int d=1;for(;(*s&=95)>d;d=*s++);return!*s;}
  4.  
  5. int main(void)
  6. {
  7. int n;
  8. char tests[8][32] = {
  9. "a",
  10. "abcdefGHIjklmnopqrSTUVWXyz",
  11. "aa",
  12. "puz",
  13. "puzz",
  14. "puzZ",
  15. "puZ",
  16. "PuZ",
  17. };
  18.  
  19. char tf[2][8] = { "false", "true" };
  20.  
  21. for (n = 0; n < 8; ++n)
  22. printf("%s => %s\n", tests[n], tf[f(tests[n])]);
  23.  
  24. return 0;
  25. }
  26.  
Success #stdin #stdout 0s 2052KB
stdin
Standard input is empty
stdout
A => true
ABCDEFGHIJKLMNOPQRSTUVWXYZ => true
AA => false
PUZ => true
PUZZ => false
PUZZ => false
PUZ => true
PUZ => true