#B3993. Calculate the Next Day's Date
Calculate the Next Day's Date
Calculate the Next Day's Date
Given a date represented by a month and a day, you are required to compute and output the date of the following day. Assume that the current year is not a leap year, hence February has 28 days. If the input date is December 31, then the output should be January 1 of the next year.
Formally, let the input be two integers m and d representing the month and day respectively. You are to calculate the next day's date as follows:
If \( d < D_m \) then the next day is \( (m, d+1) \).
If \( d = D_m \) where \( D_m \) is the number of days in month \( m \), then the next day is \( (m+1, 1) \). Exception: if \( m = 12 \) and \( d = 31 \), the next day is \( (1, 1) \).
inputFormat
The input consists of two integers separated by a space: the month (m) and the day (d).
outputFormat
Output two integers representing the month and day of the next day, separated by a space.
sample
1 1
1 2