Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class problemTwo {
- public static void main(String[] args) {
- Scanner sc =new Scanner(System.in);
- //E,T,O,P,A,H,K,X,C,B,M
- String onlyLetter =sc.nextLine();
- int n =Integer.parseInt(sc.nextLine());
- /*
- * Has a letter from the allowed letters at position 1
- Has a letter from the allowed letters at position 2
- Has a number at position 3
- Has a number at position 4
- Has a number at position 5
- Has a number at position 6
- Has a letter from the allowed letters at position 7
- Has a letter from the allowed letters at position 8
- */
- int plate =Integer.parseInt(" ") ;
- char sign = plate.charAt(1);
- char sign2 = plate.charAt(2);
- char sign3 = plate.charAt(3);
- char sign4 = plate.charAt(4);
- char sign5 = plate.charAt(5);
- char sign6 = plate.charAt(6);
- char sign7 = plate.charAt(7);
- char sign8 = plate.charAt(8);
- for(int i=0;i<n;i++){
- plate =Integer.parseInt(sc.nextLine());
- //char sign = plate.charAt(1);
- if(sign =='E' || sign =='T'|| sign =='O'||sign =='P'|| sign =='A' || sign =='H'|| sign =='K'||sign =='X'||sign =='C'||sign=='B'||sign=='M'){
- sign=onlyLetter.charAt(1);
- }
- //char sign2 = plate.charAt(2);
- if(sign =='E' || sign =='T'|| sign =='O'||sign =='P'|| sign =='A' || sign =='H'|| sign =='K'||sign =='X'||sign =='C'||sign=='B'||sign=='M'){
- sign=onlyLetter.charAt(2);
- }
- //char sign3 = plate.charAt(3);
- if(sign ==1 || sign ==2|| sign ==3||sign ==4|| sign ==5 || sign ==6|| sign ==7||sign ==8||sign ==9||sign==0){
- sign3=onlyLetter.charAt(3);
- }
- //char sign4 = plate.charAt(4);
- if(sign ==1 || sign ==2|| sign ==3||sign ==4|| sign ==5 || sign ==6|| sign ==7||sign ==8||sign ==9||sign==0){
- sign4=onlyLetter.charAt(4);
- }
- //char sign5 = plate.charAt(5);
- if(sign ==1 || sign ==2|| sign ==3||sign ==4|| sign ==5 || sign ==6|| sign ==7||sign ==8||sign ==9||sign==0){
- sign5=onlyLetter.charAt(5);
- }
- //char sign6 = plate.charAt(6);
- if(sign ==1 || sign ==2|| sign ==3||sign ==4|| sign ==5 || sign ==6|| sign ==7||sign ==8||sign ==9||sign==0){
- sign6=onlyLetter.charAt(6);
- }
- //char sign7 = plate.charAt(7);
- if(sign =='E' || sign =='T'|| sign =='O'||sign =='P'|| sign =='A' || sign =='H'|| sign =='K'||sign =='X'||sign =='C'||sign=='B'||sign=='M'){
- sign7=onlyLetter.charAt(7);
- }
- // char sign8 = plate.charAt(8);
- if(sign =='E' || sign =='T'|| sign =='O'||sign =='P'|| sign =='A' || sign =='H'|| sign =='K'||sign =='X'||sign =='C'||sign=='B'||sign=='M'){
- sign8=onlyLetter.charAt(8);
- }
- plate =sign+sign2+sign3+sign4+sign5+sign6+sign7+sign8;
- }
- System.out.println(sign+sign2+sign3+sign4+sign5+sign6+sign7+sign8);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement