// Program 63: Unique-Digit Integers in a Range import java.util.*; class UniqueDigitRange { static boolean unique(int n) { boolean[] seen = new boolean[10]; while (n > 0) { int d = n % 10; if (seen[d]) { return false; } seen[d] = true; n /= 10; } return true; } public static void main(String[] args) { Scanner sc = new Scanner(System.in); int m = sc.nextInt(), n = sc.nextInt(); if (m < 1 || m >= n || n >= 30000) { System.out.println("INVALID INPUT"); return; } ArrayList found = new ArrayList<>(); for (int x = m; x <= n; x++) { if (unique(x)) { found.add(x); } } System.out.println("THE UNIQUE-DIGIT INTEGERS ARE:"); System.out.println(found.isEmpty() ? "NIL" : found.toString().replace("[", "").replace("]", "")); System.out.println("FREQUENCY OF UNIQUE-DIGIT INTEGERS IS: " + found.size()); } }