/* Check if s1 and s2 are anagrams of each other */ int isAnagram(const char *s1, const char *s2) { int ha[CHAR_MAX] = {0}; int i; while(*s1 && *s2) { ha[*s1++]++; ha[*s2++]--; } if(*s1 || *s2) return 0; for(i=0; i<CHAR_MAX; ++i) { if(ha[i]) return 0; } return 1; }