You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
395 B
C++

#include <cstdio>
#include <algorithm>
using namespace std;
int main()
{
int x, a;
char buf[7];
while (~scanf("%d", &x))
{
for (a = x + 1;; a++)
{
sprintf(buf, "%d", a);
sort(buf, buf + 4);
if (unique(buf, buf + 4) == buf + 4)
break;
}
printf("%d\n", a);
}
return 0;
}