Add and subtract one second P56358


Statement
 

pdf   zip

thehtml

Write a program that, given a time expressed in hours, minutes and seconds, computes the time corresponding to add one second, and also the time corresponding to subtract one second.

Your program must use the definition

struct Time { int hour, minute, second; };

and it must implement and use the precedure

void one_second(const Time& t, Time& t1, Time& t2);

that leaves in t1 the time in t plus one second, and leaves in t2 the time in t minus one second. For instance, if t has 23 59 59, then t1 must be 0 0 0 and t2 must be 23 59 58.

Input

Input consists of several cases, each with three numbers (hour, minute and second) that form a correct time. That is, the hour is between 0 and 23, and the minute and the second are between 0 and 59.

Output

For every given time t, print two lines with t1 and t2.

Observation

You can implement auxiliary procedures.

Public test cases
  • Input

    10 20 30
    0 0 0
    23 59 59
    

    Output

    10 20 31
    10 20 29
    0 0 1
    23 59 59
    0 0 0
    23 59 58
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Translator
    Salvador Roura
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++
    User solutions
    C C++ Python