#include <climits> #include <iostream> #include <iterator> #include <assert.h> using namespace std; class date { public: int getmonthday(int year, int month) { assert(month > 0 && month < 13); static int arr[13] = { -1,31,28,31,30,31,30,31,31,30,31,30,31 }; if (month == 2 && ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0))) { return 29; } else { return arr[month]; } } date(int year = 1949, int month = 1, int day = 1) { _year = year; _month = month; _day = day; } bool operator==(const date& d) { return d._day == _day && _month == d._month && _year == d._year; } bool operator!=(const date& d) { return !(*this == d); } date& operator+=(int day) { _day += day; while (_day > getmonthday(_year, _month)) { _day -= getmonthday(_year, _month); _month++; if (_month == 13) { _year++; _month = 1; } } return *this; } bool operator>(const date& d)const { if (_year > d._year) { return true; } else if (_year == d._year) { if (_month > d._month) { return true; } else if (_month == d._month) { return _day > d._day; } } return false; } int operator-(const date& d)const { int flag = 1; date max = *this; date min = d; if (d > *this) { max = d; min = *this; flag = -1; } int n = 1; while (min != max) { min+=1; ++n; } return n; } private: int _year; int _month; int _day; }; int main() { int day1,day2,mon1,mon2,year1,year2; scanf("%4d%2d%2d",&year1,&mon1,&day1); scanf("%4d%2d%2d",&year2,&mon2,&day2); date d1(year1, mon1, day1); date d2(year2,mon2,day2); cout<< d1 - d2<<endl; }