Created
December 6, 2013 04:28
-
-
Save Fogest/7818574 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main; | |
import java.util.Scanner; | |
public class Main | |
{ | |
public static void main(String[] args) | |
{ | |
Scanner input = new Scanner(System.in); | |
Boolean checker = true; | |
String regex = "^(?:([0-9])(?!.*\1))*$"; | |
Pattern pattern = Pattern.compile(regex,Pattern.CASE_INSENSITIVE); | |
System.out.println("Enter the Year:"); | |
String number = input.next(); | |
Matcher matcher; | |
while(!checker) { | |
matcher = pattern.matcher(number); | |
if(matcher.find()) | |
checker = true; | |
else | |
number++; | |
} | |
System.out.println(number); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment