fork(1) download
  1. #include <stdio.h>
  2. #include <limits.h>
  3.  
  4. int allin(const char* s1, const char* s2) {
  5. char seen[UCHAR_MAX] = {0};
  6. int count = 0;
  7. while (*s1++) {
  8. if (!seen[*s1])
  9. count++;
  10. seen[*s1] = 1;
  11. }
  12. while (*s2++) {
  13. if (seen[*s2]) {
  14. seen[*s2] = 0;
  15. if (!--count)
  16. break;
  17. }
  18. }
  19. return count == 0;
  20. }
  21.  
  22. int main(void) {
  23. printf("%d", allin("abcc", "abcd"));
  24. return 0;
  25. }
  26.  
Success #stdin #stdout 0s 2296KB
stdin
Standard input is empty
stdout
1