SHARE
TWEET

Untitled

a guest Jul 16th, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class Decipherer {
  2.  
  3. /* Il faut :
  4.     - calculer la longueur de la chaine
  5.     - diviser par 2 = chiffrecle
  6.     - remplacer @#? par " "
  7.     - inverser la phrase
  8. */
  9.  
  10.     public static void main(String[] args) {
  11.        
  12.     String message1 = "0@sn9sirppa@#?ia'jgtvryko1";
  13.         String message2 = "q8e?wsellecif@#?sel@#?setuotpazdsy0*b9+mw@x1vj";
  14.         String message3 = "aopi?sedohtém@#?sedhtmg+p9l!";
  15.  
  16.         String msg1 = decodeur(message1);
  17.         String msg2 = decodeur(message2);
  18.         String msg3 = decodeur(message3);
  19.  
  20.         System.out.printf("Message 1 : %s;\nMessage 2 : %s;\nMessage 3 : %s\n", msg1, msg2, msg3);
  21.     }
  22.  
  23.     public static String decodeur (String count){
  24.        
  25.     int chiffrecle = count.length() / 2;
  26.         count = count.substring(5, (chiffrecle + 5));
  27.         count = count.replace("@#?", " ");      
  28.     String solution = new StringBuffer(count).reverse().toString();
  29.        
  30.     return solution;
  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