solved-dates problem from TopCoder