Advertisement
CR7CR7

wordCheck

Mar 9th, 2023
644
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.21 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class problemTwo {
  4.     public static void main(String[] args) {
  5.         Scanner sc =new Scanner(System.in);
  6.         //E,T,O,P,A,H,K,X,C,B,M
  7.         String onlyLetter =sc.nextLine();
  8.         int n =Integer.parseInt(sc.nextLine());
  9.         /*
  10.          * Has a letter from the allowed letters at position 1
  11. Has a letter from the allowed letters at position 2
  12. Has a number at position 3
  13. Has a number at position 4
  14. Has a number at position 5
  15. Has a number at position 6
  16. Has a letter from the allowed letters at position 7
  17. Has a letter from the allowed letters at position 8
  18.          */
  19.    
  20.          int plate =Integer.parseInt(" ") ;
  21.          char sign = plate.charAt(1);
  22.          char sign2 = plate.charAt(2);
  23.          char sign3 = plate.charAt(3);
  24.          char sign4 = plate.charAt(4);
  25.          char sign5 = plate.charAt(5);
  26.          char sign6 = plate.charAt(6);
  27.          char sign7 = plate.charAt(7);
  28.          char sign8 = plate.charAt(8);
  29.         for(int i=0;i<n;i++){
  30.             plate =Integer.parseInt(sc.nextLine());
  31.             //char sign = plate.charAt(1);
  32.             if(sign =='E' || sign =='T'|| sign =='O'||sign =='P'|| sign =='A' || sign =='H'|| sign =='K'||sign =='X'||sign =='C'||sign=='B'||sign=='M'){
  33.                 sign=onlyLetter.charAt(1);
  34.             }
  35.             //char sign2 = plate.charAt(2);
  36.             if(sign =='E' || sign =='T'|| sign =='O'||sign =='P'|| sign =='A' || sign =='H'|| sign =='K'||sign =='X'||sign =='C'||sign=='B'||sign=='M'){
  37.                 sign=onlyLetter.charAt(2);
  38.             }
  39.             //char sign3 = plate.charAt(3);
  40.             if(sign ==1 || sign ==2|| sign ==3||sign ==4|| sign ==5 || sign ==6|| sign ==7||sign ==8||sign ==9||sign==0){
  41.                 sign3=onlyLetter.charAt(3);
  42.             }
  43.             //char sign4 = plate.charAt(4);
  44.             if(sign ==1 || sign ==2|| sign ==3||sign ==4|| sign ==5 || sign ==6|| sign ==7||sign ==8||sign ==9||sign==0){
  45.                 sign4=onlyLetter.charAt(4);
  46.             }
  47.             //char sign5 = plate.charAt(5);
  48.             if(sign ==1 || sign ==2|| sign ==3||sign ==4|| sign ==5 || sign ==6|| sign ==7||sign ==8||sign ==9||sign==0){
  49.                 sign5=onlyLetter.charAt(5);
  50.             }
  51.             //char sign6 = plate.charAt(6);
  52.             if(sign ==1 || sign ==2|| sign ==3||sign ==4|| sign ==5 || sign ==6|| sign ==7||sign ==8||sign ==9||sign==0){
  53.                 sign6=onlyLetter.charAt(6);
  54.             }
  55.             //char sign7 = plate.charAt(7);
  56.             if(sign =='E' || sign =='T'|| sign =='O'||sign =='P'|| sign =='A' || sign =='H'|| sign =='K'||sign =='X'||sign =='C'||sign=='B'||sign=='M'){
  57.                 sign7=onlyLetter.charAt(7);
  58.             }
  59.            // char sign8 = plate.charAt(8);
  60.             if(sign =='E' || sign =='T'|| sign =='O'||sign =='P'|| sign =='A' || sign =='H'|| sign =='K'||sign =='X'||sign =='C'||sign=='B'||sign=='M'){
  61.                 sign8=onlyLetter.charAt(8);
  62.             }
  63.  
  64.            
  65.  
  66.             plate =sign+sign2+sign3+sign4+sign5+sign6+sign7+sign8;
  67.  
  68.            
  69.            
  70.         }
  71.    
  72.        
  73.         System.out.println(sign+sign2+sign3+sign4+sign5+sign6+sign7+sign8);
  74.  
  75.        
  76.     }
  77.  
  78.  
  79.    
  80. }
  81.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement