PivotOJ

Crochet Competition

시간 제한: 1000ms메모리 제한: 2048MB출처: NCPC 2025BOJ 35218

문제

The National Crochet Pattern Competition (NCPC) is an annual team-based event for crocheters of all skill levels, from beginner to expert. Teams design, write, and crochet original patterns within a time limit, which can range from minutes to a full week depending on the complexity---sometimes spanning weekends. Contestants may take breaks to eat, sleep, or go home, but the timer continues running.

NCPC has asked you to develop a system that calculates the total competition duration from the start and end times, provided with weekday, hour, and minute. The reported duration should be precise, correctly expressed in days, hours, and minutes, using as few components as necessary while minimizing the sum of the integer values.

입력

Input consists of two lines.

  • The first line gives the competition's start time.
  • The second line gives the competition's end time.

Times are formatted as "Www HH:MM", where

  • Www is the three-letter weekday abbreviation: Mon, Tue, Wed, Thu, Fri, Sat, or Sun.
  • HH the two-digit hour, from 0000 to 2323.
  • MM is the two-digits minutes, from 0000 to 5959.

If the start and end times are identical, the competition lasts exactly one week.

출력

Output the competition duration in days, hours, and minutes, using the singular or plural form as appropriate (e.g., 1 day, 2 days). List the components in order -- days, hours, minutes -- separating three components with commas and two with "and"; omit any component with a value of zero.

예제

예제 1

입력
Mon 08:00
Mon 15:00
출력
7 hours

예제 2

입력
Mon 10:00
Wed 08:59
출력
1 day, 22 hours, 59 minutes

예제 3

입력
Fri 20:00
Mon 08:00
출력
2 days and 12 hours
코드를 제출하려면 로그인하세요.