-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patha.cpp.txt
More file actions
69 lines (59 loc) · 1.35 KB
/
a.cpp.txt
File metadata and controls
69 lines (59 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int reverse(int t)
{
string t1 = to_string(t);
if(t1.length()==1)
{
t1 = "0"+t1;
}
reverse(t1.begin(), t1.end());
return stoi(t1);
}
string padded(int t)
{
string t1 = to_string(t);
if(t1.length()==1)
{
t1 = "0"+t1;
}
return t1;
}
int main()
{
string str;
cin>>str;
cout<<str<<endl;
int d = stoi(str.substr(0,2));
int m = stoi(str.substr(3,2));
//cout<<d<<" "<<m<<endl;
for(int i = m;i<=30;i++)
{
int tempd = reverse(i);
if(tempd>60)
{
continue;
}
if(i==m)// same month
{
if(tempd>d)
{
cout<<padded(tempd)<<":"<<padded(i)<<endl;
return 0;
}
}
else
{
cout<<padded(tempd)<<":"<<padded(i)<<endl;
return 0;
}
}
cout<<"10:01"<<endl;
return 0;
}