Company: Wipro_14march
Difficulty: medium
Latest Valid Date with Wildcards Problem Description You are given a string representing a date in the format MM-DD , where MM is a two-digit month and DD is a two-digit day. Some of the four digits may have been replaced by a question mark. Replace every question mark with a digit from 0 to 9 so that the result is a valid calendar date, and so that it is as late in the year as possible. Leap years are not considered, so February always has 28 days. The number of days in each month is: | Month | Name | Days | |---|---|---| | 01 | January | 31 | | 02 | February | 28 | | 03 | March | 31 | | 04 | April | 30 | | 05 | May | 31 | | 06 | June | 30 | | 07 | July | 31 | | 08 | August | 31 | | 09 | September | 30 | | 10 | October | 31 | | 11 | November | 30 | | 12 | December | 31 | If no replacement produces a valid date, the answer is the string xx-xx . Input Format A single line containing the pattern: exactly five characters, where the third is a hyphen and the other four are each a digit or