<p>Write a program to count the number of days between two dates.</p>

<p>The two dates are given as strings, their format is <code>YYYY-MM-DD</code>&nbsp;as shown in the examples.</p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<pre><strong>Input:</strong> date1 = "2019-06-29", date2 = "2019-06-30"
<strong>Output:</strong> 1
</pre><p><strong class="example">Example 2:</strong></p>
<pre><strong>Input:</strong> date1 = "2020-01-15", date2 = "2019-12-31"
<strong>Output:</strong> 15
</pre>
<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
	<li>The given dates are valid&nbsp;dates between the years <code>1971</code> and <code>2100</code>.</li>
</ul>

class Solution:
    def isLeapYear(self, year):
        return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0)
    
    def f(self, date):
        start_year, start_month, start_day = 1900, 1, 1
        year, month, day = map(int,date.split("-"))
        days = day
        while start_year < year:
            if self.isLeapYear(start_year):
                days += 366
            else:
                days += 365
            start_year += 1
        
        while start_month < month:
            if start_month in (1,3,5,7,8,10,12):
                days += 31
            elif start_month == 2:
                days += (29 if self.isLeapYear(year) else 28)
            elif start_month in (4,6,9,11):
                days += 30

            start_month += 1
        
        return days

    def daysBetweenDates(self, date1: str, date2: str) -> int:
       #print(self.f(date1), self.f(date2))
        return abs(self.f(date1) - self.f(date2))
16700