You are given the current time R in the HH:MM:SS format. You are also given N more time values in an array P, where every element P[i] is less than or equal to R.
Write a program to calculate the time difference between P[i] and R and print one of the following messages accordingly:
Input format
Output format
For each P[i], print the message indicating the time difference.
Constraints
0≤HH≤23
0≤MM≤59
0≤SS≤59
1≤N≤1000
R = 23:05:38
Now for each P[i]:
R−P[0]⇒ 23:05:38 - 23:05:38
⇒ 00:00:00
. Time difference is zero. Hence the answer is "now".
R−P[1]⇒ 23:05:38 - 23:05:02
⇒ 00:00:36
. Time difference is 36 seconds. Hence the answer is "36 seconds ago".
R−P[2]⇒ 23:05:38 - 23:04:59
⇒ 00:00:39
. Time difference is 39 seconds. Hence the answer is "39 seconds ago".
R−P[3]⇒ 23:05:38 - 23:04:31
⇒ 00:01:07
. Time difference is 1 min 7 seconds. According the rules, when time difference is in minutes but less than an hour, we ignore the seconds part of the difference. Hence the answer is "1 minute ago".
R−P[4]⇒ 23:05:38 - 12:36:07
⇒ 10:29:31
. Time difference is 10 hours 29 mins 31 seconds. According the rules, when time difference is in hours, we ignore the minutes and seconds part of the difference. Hence the answer is "10 hours ago".
R−P[5]⇒ 23:05:38 - 08:59:01
⇒ 14:06:37
. Time difference is 14 hours 6 mins 37 seconds. According the rules, when time difference is in hours, we ignore the minutes and seconds part of the difference. Hence the answer is "14 hours ago".
R−P[6]⇒ 23:05:38 - 00:00:00
⇒ 23:05:38
. Time difference is 23 hours 5 mins 38 seconds. According the rules, when time difference is in hours, we ignore the minutes and seconds part of the difference. Hence the answer is "23 hours ago".