Since everyone else is posting their favourite anagrams programs, I thought I'd play too. I hacked this one up in about 5 mins some time ago when I was discussing anagrams and word stuff with Tom Christiansen some time ago. This doesn't do multi-word anagrams, but it *does* find *all* the one-word anagrams in your word list at once. Graham --- You'll need a system sort utility to do a straight alpha sort of lines in a file. Compile the two progs canonize.c and gather.c Run this pipeline: canonize < wordlist | sort | gather (Or if not unix, canonize < wordlist > canon sort < canon > flowers gather < flowers ) ============================= canonize.c =================================== #include #include int charcmp(const char *c1, const char *c2) { return(*c1-*c2); } int main(int argc, char **argv) { char word[256], canon[256]; for (;;) { if (gets(word) == NULL) break; strcpy(canon, word); qsort(canon, strlen(canon), sizeof(char), charcmp); printf("%s=%s\n", canon, word); } return(0); } ============================== gather.c ==================================== #include #include int main(int argc, char **argv) { char line[256], lastcanon[256], lastword[256], *word; strcpy(lastcanon, "*Undefined*"); for (;;) { if (gets(line) == NULL) break; if ((word = strchr(line, '=')) == NULL) break; *word++ = '\0'; if (strcmp(line, lastcanon) == 0) { printf("%s = %s\n", lastword, word); } strcpy(lastcanon, line); strcpy(lastword, word); } return(0); }