refactored hangman isalpha check into a function