Made the program extensible. The number of sub-words can be specified.