Welcome to ZOJ
Select Problem
ZOJ Problem Set - 2534
Time Machine

Time Limit: 5 Seconds      Memory Limit: 32768 KB

In the year 2999, scientist Tom finally makes a time machine. People can use this machine to fly throngh from year 2000 to year 2999. But this machine has one strange characteristic that usually you can't go to the date you want directly. The date the machine will go in one step is fixed. If you are in step N and the date now is YYYY-MM-DD, the next date is K days after current date (K = (YYYY + MM + DD), note that the date count is a cycle, i.e. 2000-01-01 is one day after 2999-12-31, etc.). Of course that you can choose not to move in current step (This means the date will move into the date that is one day after current date). So, as a professional programmer, your task is to write a program to decide the minimum steps needed of going from one date to a specified date by using this strange time machine.


The input consists of several lines. Each line is a test case and contains two date in YYYY-MM-DD format. The first one is the date that go from and the second one is the date that go to. Note that all the date will be from 2000-01-01 to 2999-12-31. Process to the END-OF-FILE.


For each test case, there's one line output that contains only one integer, the minimum steps needed.

Sample Input
2000-01-01 2000-01-03
Sample Output

Author: ZHOU, Ran
Source: CYJJ's Funny Contest #3, Having Fun in Summer
Submit    Status