Three convicts A,B and C were about to be executed. When they begged for a last chance, the hangman decided to let them battle it out with their wits.
So he put the 3 men on a flight of stairs, A at the top of the flight of stairs followed by B in the middle and then C at the base of the stairs. They are made to stand such that A can see B and C, and B can only see C, but can't see A, and C can see none.
They were then blindfolded, and on each of their head, he put a coloured cap; the colour of the cap can only either be black or white. The only thing they know for certain is that not all three hats have the same colour.
So the hangman wanted them to tell him what coloured hat is on their head within the next 5 seconds after he removed the blindfold. If any one who could guess his hat colour correctly, he would save the life of all 3 men.
After 4 seconds of his removing their blindfolds, the one in the middle {B} answered the question, and it was correct.
How did he do it?
You can assume that all the blindfolds were removed at the same moment.