Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Pr02LettersCombinations {
- public static void main(String[] args) {
- final Scanner scanner = new Scanner(System.in);
- char start = scanner.nextLine().charAt(0);
- char end = scanner.nextLine().charAt(0);
- char skip = scanner.nextLine().charAt(0);
- int combinationsCount = 0;
- for (char first = start; first <= end; first++) {
- if (first == skip) {
- continue;
- }
- for (char second = start; second <= end; second++) {
- if (second == skip) {
- continue;
- }
- for (char third = start; third <= end; third++) {
- if (third == skip) {
- continue;
- }
- System.out.printf("%c%c%c ", first, second, third);
- combinationsCount++;
- }
- }
- }
- System.out.println(combinationsCount);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement