fork download
  1.  
  2. package BeautifulYear;
  3.  
  4. import java.util.Scanner;
  5.  
  6. public class BeautifulYear {
  7.  
  8.  
  9. public static void main(String[] args) {
  10.  
  11. Scanner scan = new Scanner(System.in);
  12. int firstDigit[] = new int[4];
  13. int oldYear = scan.nextInt();
  14. int newYear = ++oldYear;
  15. int count = 0;
  16. boolean notValidYear = false;
  17.  
  18. while (true)
  19. {
  20. notValidYear = false;
  21. while (newYear > 0)
  22. {
  23. firstDigit[count++] = (newYear % 10);
  24. newYear /= 10;
  25. }
  26. for (int j = 0; j < 4; j++)
  27. {
  28. for (int k = j + 1; k < 4; k++)
  29. {
  30. if (firstDigit[j] == firstDigit[k])
  31. {
  32. newYear = ++oldYear;
  33. count = 0;
  34. notValidYear = true;
  35. break;
  36. }
  37. }
  38. }
  39. if (notValidYear == false) break;
  40. }
  41. System.out.println(oldYear);
  42. }
  43. }
  44.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:6: error: class BeautifulYear is public, should be declared in a file named BeautifulYear.java
public class BeautifulYear {
       ^
1 error
stdout
Standard output is empty