Advertisement
chono55

CombLetters

Jun 25th, 2019
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.10 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class LettersCombinations {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         String fl = scanner.nextLine();
  8.         String sl = scanner.nextLine();
  9.         String tl = scanner.nextLine();
  10.  
  11.        int start = (int)fl.charAt(0);
  12.        int end = (int)sl.charAt(0);
  13.        int skip = (int)tl.charAt(0);
  14.        int count = 0;
  15.  
  16.        for (int i = start; i <= end; i++){
  17.            if(i == skip){
  18.                continue;
  19.            }
  20.            for (int o = start; o <= end; o++){
  21.                if(o == skip){
  22.                    continue;
  23.                }
  24.                for(int p = start; p <= end;p++){
  25.                    if(p == skip){
  26.                        continue;
  27.                    }
  28.                    char one = (char)i;
  29.                    char two = (char)o;
  30.                    char three = (char)p;
  31.                    count++;
  32.                    System.out.printf("%c%c%c ",one,two,three);
  33.  
  34.                }
  35.            }
  36.        }
  37.  
  38.         System.out.printf("%d",count);
  39.  
  40.  
  41.  
  42.     }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement