SHARE
TWEET

Untitled

a guest Oct 17th, 2019 101 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         int ticket = Integer.parseInt(scanner.nextLine());
  8.         for (int i = 0; i < ticket; i++){
  9.             String combination = scanner.nextLine();
  10.             int getFirst = (int)combination.charAt(0);
  11.             if (combination.length() > 4){
  12.                 System.out.print("Seat decoded: ");
  13.                 System.out.print(combination.charAt(0));
  14.                 int num = (int)combination.charAt(1);
  15.                 System.out.print(num);
  16.                 System.out.println();
  17.             }else if  (getFirst > 64 && getFirst < 91){
  18.                 System.out.print("Seat decoded: ");
  19.                 System.out.println(combination.substring(0, 3));
  20.             } else {
  21.                 System.out.print("Seat decoded: ");
  22.                 for (int j = combination.length() -1; j >= 0; j--){
  23.                     if (j == 3){
  24.                         System.out.print(combination.charAt(j));
  25.                     } else if (j == 1){
  26.                         System.out.print(combination.charAt(j));
  27.                         System.out.print(combination.charAt(j+1));
  28.                     }
  29.                 }
  30.                 System.out.println();
  31.             }
  32.         }
  33.     }
  34. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top