fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. bool visited[10];
  4.  
  5. bool check(int n)
  6. {
  7. for (int i = 0; i <= 9; i++) visited[i] = false;
  8. while (n != 0)
  9. {
  10. if (visited[n%10] == true) return false;
  11. visited[n%10] = true;
  12. n /= 10;
  13. }
  14. return true;
  15. }
  16.  
  17. int main()
  18. {
  19. freopen("SODOCLAP.inp","r",stdin);
  20. freopen("SODOCLAP.out","w",stdout);
  21. int n;
  22. cin >> n;
  23. while (check(n) == false)
  24. n++;
  25. cout << n;
  26. return 0;
  27. }
Success #stdin #stdout 0.01s 5316KB
stdin
Standard input is empty
stdout
Standard output is empty