# HackerEarth Sherlock and Date problem solution

In this HackerEarth Sherlock and Date problem solution Watson gives a date to Sherlock and asks him what is the date on the previous day. Help Sherlock. You are given a date in DD MM YYYY format. DD is an integer without leading zeroes. MM is one of the "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November" and "December" (all quotes for clarity). YYYY is also an integer between 1600 and 2000 without leading zeroes. You have to print the date of the previous day in the same format.

## HackerEarth Sherlock and Date problem solution.

`import datetimefrom datetime import date, timedeltan = int(raw_input())while n>0 :    date = raw_input();    day , month ,year = date.split();    assert(int(day)>0 & int(day)<31)    #print(day+" "+month+" "+year)    map = {        'January':1,        'February':2,        'March':3,        'April':4,        'May':5,        'June':6,        'July':7,        'August':8,        'September':9,        'October':10,        'November':11,        'December':12    }    mlist = [        'January',        'February',        'March',        'April',        'May',        'June',        'July',        'August',        'September',        'October',        'November',        'December'    ]    mydate = (datetime.date(int(year),map[month],int(day)))  #year, month, day    #mydate =mydate+datetime.timedelta(years=40)    mydate= mydate-datetime.timedelta(days=1)    mydate = mydate.isoformat();    #print(mydate)    year ,month,day = mydate.split('-')    #print(year+" "+month+" "+day)    #print(mydate.strftime("%Y-%m-%d"))    #year = mydate.strftime("%Y");    if(int(month)<10):        month = month.strip("0");    #day = mydate.strftime("%d");    if(int(day)<10):       day = day.strip("0")    #print(month);    print(day+" "+mlist[int(month)-1] +" "+year)    n=n-1`