#K81647. Human Readable Duration Format
Human Readable Duration Format
Human Readable Duration Format
This problem requires you to convert a non-negative integer representing seconds into a human-readable format. The duration should be broken down into years, days, hours, minutes, and seconds according to the following intervals:
- 1 year = 365 \(\times\) 24 \(\times\) 60 \(\times\) 60 = 31536000 seconds
- 1 day = 24 \(\times\) 60 \(\times\) 60 = 86400 seconds
- 1 hour = 60 \(\times\) 60 = 3600 seconds
- 1 minute = 60 seconds
- 1 second = 1 second
Your task is to format the duration in a natural language format using commas and the word "and" where appropriate. For example, an input of 62
should produce the output 1 minute and 2 seconds
.
inputFormat
The input is a single non-negative integer seconds
provided via standard input (stdin), representing the duration in seconds.
outputFormat
The output is a single line string printed to standard output (stdout), showing the human-readable format of the duration.
## sample0
now