<P> Hermann attends the funeral of the countess , and is terrified to see the countess open her eyes in the coffin and look at him . Later that night , the ghost of the countess appears . The ghost names the secret three cards ( three , seven , ace ) , tells him he must play just once each night and then orders him to marry Lizavyeta . Hermann takes his entire savings to Chekalinsky 's salon , where wealthy men gamble for high stakes . On the first night , he bets it all on the three and wins . On the second night , he wins on the seven . On the third night , he bets on the ace -- but when cards are shown , he finds he has bet on the Queen of Spades , rather than the ace , and loses everything . When the Queen appears to wink at him , he is astonished by her remarkable resemblance to the old countess , and flees in terror . In a short conclusion , Pushkin writes that Lizavyeta marries the son of the Countess ' former steward , a state official who makes a good salary . Hermann , however , goes mad and is committed to an asylum . He is installed in Room 17 at the Obuhov hospital ; he answers no questions , but merely mutters with unusual rapidity : `` Three , seven , ace ! Three , seven , queen ! '' </P>
what happens to hermann at the end of the story
goes mad and is committed to an asylum