Check whether a word is iilegal or legal