A. palindromic times

Source: Internet
Author: User
Time limit per test

2 seconds

Memory limit per test

256 megabytes

Input

Standard Input

Output

Standard output

Tattah is asleep if and only if tattah is attending a lecture. This is a well-known formula among tattah's colleagues.

On a Wednesday afternoon, tattah was attending serving sor HH's lecture. At, right before falling asleep, he was staring at the digital watch
Around und Saher's wrist. He noticed that the digits on the clock were the same when read from both directions I. e. a palindrome.

In his sleep, he started dreaming about such rare moments of the day when the time displayed on a digital clock is a palindrome. as soon as he woke up, he felt destined to write a program that finds the next such moment.

However, he still hasn't mastered the skill of programming while sleeping, so your task is to help him.

Input

The first and only line of the input starts with a string with the format "HH: mm" where "hh"
Is from "00" to "23" and "mm"
Is from "00" to "59". Both
"Hh" and "mm" have exactly
Two digits.

Output

Print the palindromic time of day that comes soonest after the time given in the input. If the input time is palindromic, output the soonest palindromic time after the input time.

Sample test (s) Input
12:21
Output
13:31
Input
23:59
Output
00:00

Solution Description: This question is similar to a text return string, but only for specific time display. You can cycle from the current time until you find the time that meets the requirements. Pay attention to carry.

#include<iostream>#include<map>#include<string>#include<algorithm>#include<cstdio>#include<cmath>using namespace std;int main(){int h,m;char c;cin>>h>>c>>m;while (1>0){ m++;h+=(m/60);m%=60;h%=24;if (h/10==m%10 && h%10==m/10){break;}}cout<

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.