Added helper function to check if input character is in the word