#include <cmath> #include <cstdio> #include <iostream> #include <algorithm> using namespace std; int month[2][13] = { {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},//平年 {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}//闰年 }; int sum[2][12]; bool judge(int y) { if (y % 400 == 0 || y % 100 != 0 && y % 4 == 0) return true; return false; } int getDays(int y, int m, int d) {//获取在该年的第几天 if (judge(y)) return sum[1][m - 1] + d; return sum[0][m - 1] + d; } int main() { for (int i = 1; i <= 12; i++) { sum[0][i] = sum[0][i - 1] + month[0][i];//平年 sum[1][i] = sum[1][i - 1] + month[1][i];//闰年 } int y1, m1, d1, y2, m2, d2; while (scanf("%4d%2d%2d", &y1, &m1, &d1) != EOF) { scanf("%4d%2d%2d", &y2, &m2, &d2); int res = 0; if (y1 < y2) { res = getDays(y2, m2, d2) - getDays(y1, m1, d1); for (int i = y1; i < y2; i ++) { res += 365; if (judge(i)) res += 1; //闰年多一天 } } else if (y1 == y2) { res = fabs(getDays(y2, m2, d2) - getDays(y1, m1, d1)); } else { res = getDays(y1, m1, d1) - getDays(y2, m2, d2); for (int i = y2; i < y1; i ++) { res += 365; if (judge(i)) res += 1; //闰年多一天 } } cout << res + 1 << endl; } return 0; }