Hangman game with exception handling