P27620 [洛谷] Tomorrow and Tomorrow
普及-
题目描述

Problem Description

Given a date, the task is to output the date of the following day. Assume that this year is not a leap year.

The input consists of two integers representing the month and the day. You need to write a program to calculate and output the date of the next day. If the input date is the last day of the year (December 31), the output should be January 1 of the next year.

Input Format

The input consists of a single line containing two integers, representing the month \( M \) and the day \( D \).

  • \( M \) is an integer representing the month (\(1 \leq M \leq 12\)).
  • \( D \) is an integer representing the day (\(1 \leq D \leq 31\), and not exceeding the maximum number of days in the month).

Output Format

Output a single line containing two integers, representing the month and day of the following day.

Sample Input and Output

Sample Input #1

3 14

Sample Output #1

3 15

Sample Input #2

4 30

Sample Output #2

5 1

Sample Input #3

12 31

Sample Output #3

1 1

Notes/Hints

  • The number of days in each month is as follows:
  • January: 31 days
  • February: 28 days (not considering leap years)
  • March: 31 days
  • April: 30 days
  • May: 31 days
  • June: 30 days
  • July: 31 days
  • August: 31 days
  • September: 30 days
  • October: 31 days
  • November: 30 days
  • December: 31 days

  • The input is guaranteed to be a valid date, so no validation of the date's validity is necessary.

Example Explanation

For Sample Input #1, the day after March 14 is March 15.

For Sample Input #2, the day after April 30 is May 1.

For Sample Input #3, the day after December 31 is January 1 of the next year.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3 14
样例输出
3 15