Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Decipherer {
- /* Il faut :
- - calculer la longueur de la chaine
- - diviser par 2 = chiffrecle
- - remplacer @#? par " "
- - inverser la phrase
- */
- public static void main(String[] args) {
- String message1 = "0@sn9sirppa@#?ia'jgtvryko1";
- String message2 = "q8e?wsellecif@#?sel@#?setuotpazdsy0*b9+mw@x1vj";
- String message3 = "aopi?sedohtém@#?sedhtmg+p9l!";
- String msg1 = decodeur(message1);
- String msg2 = decodeur(message2);
- String msg3 = decodeur(message3);
- System.out.printf("Message 1 : %s;\nMessage 2 : %s;\nMessage 3 : %s\n", msg1, msg2, msg3);
- }
- public static String decodeur (String count){
- int chiffrecle = count.length() / 2;
- count = count.substring(5, (chiffrecle + 5));
- count = count.replace("@#?", " ");
- String solution = new StringBuffer(count).reverse().toString();
- return solution;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement