Write a program that takes as argument the path to a file containing one word per line, groups the words that are anagrams to each other, and writes to the standard output each of these groups.
The groups should be separated by newlines and the words inside each group by commas.
You can make the following assumptions about the data in the files:
- The words in the input file are ordered by size
- Production files will not fit into memory all at once (but all the words of the same size would)
- The words are not necessarily actual English words, for example, “abc” and “cba” are both considered words for the sake of this exercise.
The files provided in the Data
folder are just sample input data to help you reason about the problem. Production files will be much bigger.
abc,bac,cba
unf,fun
hello
Requirements:
- node v14.17.x
yarn
yarn dev
yarn
yarn test
// Coverage report
yarn test --coverage