P1425 Little Fish's Swimming Time

Description

The London Olympics are coming, and Little Fish is training hard for the swimming competition. Poor Little Fish doesn’t know that fish cannot participate in the human Olympics. On this day, Little Fish measured its swimming time precisely (all timing in this problem uses the $24$-hour clock). It found that it swam from $a$ hours $b$ minutes to $c$ hours $d$ minutes on the same day. Please help Little Fish calculate how long it swam in total that day. Little Fish worked really hard, so please don’t miscalculate.

Input Format

A single line contains four integers separated by spaces, representing $a, b, c, d$ in the statement.

Output Format

Output two integers $e$ and $f$ in one line, separated by a space, indicating how many hours and minutes Little Fish swam in total that day. The minutes integer $f$ should be less than $60$.

Explanation/Hint

For all testdata, $0 \le a, c \le 24$, $0 \le b, d \le 60$, and the end time is guaranteed to be later than the start time. Translated by ChatGPT 5