Added safer reading of input - if word length exceeds the hardcoded MAX_WLEN, the word is split to fragments of MAX_WLEN each. Currently, MAX_WLEN is defined to be 1000.