-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbeutifulyear.java
More file actions
33 lines (27 loc) · 837 Bytes
/
beutifulyear.java
File metadata and controls
33 lines (27 loc) · 837 Bytes
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
import java.util.*;
public class beutifulyear {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int year = sc.nextInt();
while (true) {
year++;
String s = Integer.toString(year);
boolean hasDuplicate = false;
for (int i = 0; i < s.length(); i++) {
for (int j = i + 1; j < s.length(); j++) {
if (s.charAt(i) == s.charAt(j)) {
hasDuplicate = true;
break;
}
}
if (hasDuplicate)
break;
}
if (!hasDuplicate) {
break;
}
}
System.out.println(year);
sc.close();
}
}