test boundary cases of longestWord()