finished getGuessedWord function