refactor: empty word is now considered prefix of any word