la-ma-rin

deciphering

Apr 6th, 2019
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.75 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class deciphering {
  4.     public static void main(String[] args) {
  5.         Scanner scan = new Scanner(System.in);
  6.  
  7.         String input = scan.nextLine();
  8.         String[] input2 = scan.nextLine().split("\\s+");
  9.  
  10.         String output = "";
  11.  
  12.         if (input.charAt(0) < 100 && !input.contains("{}#\\|")) {
  13.             System.out.println("This is not the book you are looking for.");
  14.             return;
  15.         }
  16.  
  17.         for (int i = 0; i < input.length(); i++) {
  18.             char x = (char) (input.charAt(i) - 3);
  19.             output += x;
  20.         }
  21.  
  22.         while (output.contains(input2[0])) {
  23.             output = output.replace(input2[0], input2[1]);
  24.         }
  25.         System.out.println(output);
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment