Puzzle #32

A train makes three stops during a ride. A ticket costs 12 cents to the first stop, 21 cents to the second stop, and 25 cents to the third stop. A passenger gives the driver 25 cents. Without saying a word, the driver gives the passenger a ticket to the last stop. How did he know?