class Solution:
    def reformatDate(self, date: str) -> str:
        dic = dict(
        Jan = '01',
        Feb = '02',
        Mar = '03',
        Apr = '04',
        May = '05',
        Jun = '06',
        Jul = '07',
        Aug = '08',
        Sep = '09',
        Oct = '10',
        Nov = '11',
        Dec = '12'
        )
        if len(date) < 13:
            dd,mmm,yyyy = date[:1], date[4:7], date[-4:]
        else:
            dd,mmm,yyyy = date[:2], date[5:8], date[-4:]
      

        return f'{yyyy}-{dic[mmm]}-{dd.zfill(2)}'
        
