-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathq2013.java
More file actions
36 lines (34 loc) · 921 Bytes
/
q2013.java
File metadata and controls
36 lines (34 loc) · 921 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
34
35
36
import java.io.*;
/**
* Write a description of class Main here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class q2013
{
public static void main(String[] args) throws IOException
{
BufferedReader b = new BufferedReader(new InputStreamReader(System.in));
int y = Integer.parseInt(b.readLine());
int k = 1;
boolean distinct = false;
while(!distinct)
{
String[] s = ((y+k)+"").split("");
distinct = true;
for(int i = 0; i<s.length;i++)
{
for(int j = i+1; j<s.length; j++)
{
if(s[i].equals(s[j]) && j != i)
{
distinct = false;
}
}
}
k++;
}
System.out.println(y+k-1);
}
}