-
Notifications
You must be signed in to change notification settings - Fork 0
/
BeautifulYear.cc
50 lines (46 loc) · 1.03 KB
/
BeautifulYear.cc
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
#ifndef LOCAL
#pragma GCC optimize(2)
#endif
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vi;
typedef pair<ll,ll> ii;
#define pb push_back
#define fst first
#define snd second
#define ALL(cont) cont.begin(), cont.end()
#define mset(a,b) memset(a,b,sizeof(a));
#define fore(i, a, b) for (int i = a, almo5t = b; i < almo5t; ++i)
#define SZ(x) ((int)x.size())
#define FIN ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
bool is_beautiful(string s){
//return true if all the digits in the number are different
set<char> se;
for(char c : s) se.insert(c);
return se.size() == s.size();
}
void solve(){
int n;cin>>n;
fore(i,n+1,123457){
string s = to_string(i);
if(is_beautiful(to_string(i))){
cout<<i<<endl;
return;
}
}
}
int main()
{
FIN;
#ifdef LOCAL
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#else
#define endl '\n'
#endif
int t=1;
// cin>>t;
while(t--)solve();
return 0;
}