Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Task6181216 {
- public static void main(String[] args){
- int combinations=0;
- char startChar, endChar, excludeChar;
- Scanner scanner = new Scanner(System.in);
- StringBuilder sb = new StringBuilder();
- startChar = scanner.nextLine().charAt(0);
- endChar = scanner.nextLine().charAt(0);
- excludeChar = scanner.nextLine().charAt(0);
- for (char i = startChar; i <= endChar ; i++) {
- if (i==excludeChar){
- continue;
- }
- for (char j = startChar; j <= endChar ; j++) {
- if (j==excludeChar){
- continue;
- }
- for (char k = startChar; k <= endChar ; k++) {
- if (k==excludeChar) {
- continue;
- }
- combinations++;
- sb.append(i);
- sb.append(j);
- sb.append(k);
- sb.append(" ");
- }
- }
- }
- System.out.print(sb.toString());
- System.out.println(combinations);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement