fork(2) download
  1. #include <stdio.h>
  2.  
  3. f(s,p)char*s;{for(p/=8;*s;)p^=*s>>4^*s++;p^=p/4;return p%4%3;}
  4.  
  5. int main (int argc, char **argv) {
  6.  
  7. printf("%d\n", f("0", 'e'));
  8. printf("%d\n", f("Foo", 'e'));
  9. printf("%d\n", f("Hello World!", 'o'));
  10. printf("%d\n", f("Alex is wrong", 'e'));
  11. printf("%d\n", f("Programming Puzzles and Code-Golf", 'e'));
  12. printf("%d\n", f("Programming Puzzles and Code-Golf", 'o'));
  13.  
  14. return 0;
  15. }
  16.  
Success #stdin #stdout 0s 2156KB
stdin
Standard input is empty
stdout
0
1
0
1
0
1