Advertisement
Guest User

Untitled

a guest
Jan 25th, 2020
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Mainxy {
  4.  
  5. public static void main(String[] args) {
  6. Scanner sc = new Scanner(System.in);
  7. String year = sc.nextLine();
  8. boolean foundSame = true;
  9. int currentYear = Integer.parseInt(year) + 1;
  10. while(foundSame) {
  11. foundSame = false;
  12. char[] y = (currentYear + "").toCharArray();
  13. for(int i = 0; i < y.length; i++) {
  14. for(int j = i + 1; j < y.length; j++) {
  15. if(y[i] == y[j]) {
  16. foundSame = true;
  17. }
  18. }
  19. }
  20. if(foundSame) currentYear++;
  21. }
  22. System.out.println(currentYear);
  23. }
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement