print("Write date in dd/mm/yyyy format")
print("Enter the values of first date")
d1=int(input("Enter the dd = "))
print("If month from 1 to 9 write without zero else write normally")
m1=int(input("Enter the mm = "))
y1=int(input("Enter the yyyy = "))
print("Enter the values of second date")
d2=int(input("Enter the dd = "))
print("If month from 1 to 9 write without zero else write normally")
m2=int(input("Enter the mm = "))
y2=int(input("Enter the yyyy = "))
print("""
YES = 1
N0 = 0""")
l=int(input("Include the end date or not = "))
print("The first date entered =",d1,"/",m1,"/",y1)
print("The second date entered =",d2,"/",m2,"/",y2)
if (y1)%4==0:
if m1==2:
if (d1>0 and d1<=29): print(end="")
else: print("The first date is invalid")
if (m1==1 or m1==3 or m1==5 or m1==7 or m1==9 or m1==11):
if(d1>0 and d1<=30): print("")
else: print("The first date is invalid")
elif (m1==4 or m1==6 or m1==8 or m1==10 or m1==12):
if(d1>0 and d1<=31):print("")
else: print("The first date is invalid")
else:print("The first date is invalid")
else:
if m1==(2):
if (d1>0 and d1<=28): print(end="")
else: print("The date is invalid")
if (m1==1 or m1==3 or m1==5 or m1==7 or m1==9 or m1==11):
if(d1>0 and d1<=30): print("")
else: print("The date is invalid")
elif (m1==4 or m1==6 or m1==8 or m1==10 or m1==12):
if(d1>0 and d1<=31):print(end="")
else: print("The date is invalid")
else:print("The date is invalid")
if (y2)%4==0:
if m2==2:
if (d2>0 and d2<=29): print(end="")
else: print("The second date is invalid")
if (m2==1 or m2==3 or m2==5 or m2==7 or m2==9 or m2==11):
if(d2>0 and d2<=30): print("")
else: print("The second date is invalid")
elif (m2==4 or m2==6 or m2==8 or m2==10 or m2==12):
if(d2>0 and d2<=31):print("")
else: print("The second date is invalid")
else:print("The second date is invalid")
else:
if m1==(2):
if (d2>0 and d2<=28): print(end="")
else: print("The second date is invalid")
if (m2==1 or m2==3 or m2==5 or m2==7 or m2==9 or m2==11):
if(d2>0 and d2<=30): print("")
else: print("The second date is invalid")
elif (m2==4 or m2==6 or m2==8 or m2==10 or m2==12):
if(d2>0 and d2<=31):print(end="")
else: print("The second date is invalid")
else:print("The second date is invalid")
if (d1>0 and d1<=31 and d2>0 and d2<=31):
x=abs(d2-d1)
y=abs(m2-m1)
z=abs(y2-y1)
if l==0:print("The interval between the entered dates =",x,"days",y,"months",z,"years")
elif l==1:print("The interval between the entered dates =",x+1,"days",y,"months",z,"years")
else:print(end="")
else:print(end="")