George woke up and saw the current time s on the digital clock. Besides, George knows that he has slept for time t.
Help George! Write a program that will, given time s and t, determine the time p when George went to bed. Note that George could have gone to bed yesterday relatively to the current time (see the second test sample).
The first line contains current time s as a string in the format "hh:mm". The second line contains time t in the format "hh:mm" — the duration of George's sleep. It is guaranteed that the input contains the correct time in the 24-hour format, that is, 00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59.
In the single line print time p — the time George went to bed in the format similar to the format of the time in the input.
05:50 05:44
00:06
00:00 01:00
23:00
00:01 00:00
00:01
#include<stdio.h>
int main()
{
int hh2,mm2;
int h2,m2;
int ph2,pm2;
int m,n,s;
scanf("%d:%d",&hh2,&mm2);
scanf("%d:%d",&h2,&m2);
if(hh2==0&&mm2==0)
{hh2=24;}
m=hh2*60+mm2;
n=h2*60+m2;
if(m<n)
m+=24*60;
s=m-n;
ph2=s/60;
pm2=s%60;
printf("%02d:%02d",ph2,pm2);
return 0;
}