#include <iostream>
#include <string>
using namespace std;
int main()
{
int year;
string s;
cin>>year;
while(1)
{
year++;
s=to_string(year);
if(s[0]!=s[1]&&s[0]!=s[2]&&s[0]!=s[3]&&s[1]!=s[2]&&s[1]!=s[3]&&s[2]!=s[3])
{
cout<<s<<endl;
break;
}
}
return 0;
}
if you having trouble to understand this, you can also find the code here... https://attopgames.blogspot.com/2022/01/271a-beautiful-year-codeforces-solution.html
Auto comment: topic has been updated by Lord_AK (previous revision, new revision, compare).
Auto comment: topic has been updated by Lord_AK (previous revision, new revision, compare).