Ten students are caught cheating on a math exam and the teacher wants to give them a final chance. He makes them sit on separate rows, each one behind the other, facing the board. Each one sees all others at the front (i.e. 10th row student sees 9 students, 9th sees 8 students, ..., 1st one sees no one).
He puts a hat on each student's head randomly, white or red. If at least 9 of them guess what color hat is on his or her head, the teacher will release them without punishment. Each student is allowed to talk once and may only say one word, which is his or her guess. They may decide on a strategy before starting to talk. Once they begin, they are not allowed to say or do anything else but guessing a color. Only one student is allowed to make a mistake.
What kind of a strategy should they follow?
See also Infinite Hats.