Advertisement
Lyubohd

Untitled

Jun 22nd, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.80 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class LettersCombinations {
  4.     public static void main(String[] args) {
  5.  
  6.         Scanner scan = new Scanner(System.in);
  7.  
  8.         char fromSymbol = scan.nextLine().charAt(0);
  9.         char toSymbol = scan.nextLine().charAt(0);
  10.         char toIgnore = scan.nextLine().charAt(0);
  11.         int counter = 0;
  12.  
  13.         for (char i = fromSymbol; i <= toSymbol; i++) {
  14.             for (char j = fromSymbol; j <= toSymbol; j++) {
  15.                 for (char k = fromSymbol; k <= toSymbol; k++) {
  16.                     if (i != toIgnore && j != toIgnore && k != toIgnore) {
  17.                         System.out.print("" + i + j + k + " ");
  18.                         counter++;
  19.                     }
  20.                 }
  21.             }
  22.         }
  23.         System.out.println(counter);
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement