Advertisement
Spocoman

Letters Combinations

Sep 7th, 2024
387
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.71 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         char x = scanner.nextLine().charAt(0),
  7.                 y = scanner.nextLine().charAt(0),
  8.                 z = scanner.nextLine().charAt(0);
  9.  
  10.         int counter = 0;
  11.  
  12.         for (int i = x; i <= y; i++) {
  13.             for (int k = x; k <= y; k++) {
  14.                 for (int j = x; j <= y; j++) {
  15.                     if (i != z && k != z && j != z) {
  16.                         System.out.printf("%c%c%c ", i, k, j);
  17.                         counter++;
  18.                     }
  19.                 }
  20.             }
  21.         }
  22.  
  23.         System.out.println(counter);
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement