Skip to content

Instantly share code, notes, and snippets.

@swann44
Created March 17, 2020 16:44
Show Gist options
  • Save swann44/a8ef823de84b7d11978aa440fab93cc6 to your computer and use it in GitHub Desktop.
Save swann44/a8ef823de84b7d11978aa440fab93cc6 to your computer and use it in GitHub Desktop.
Java5
class Decipherer {
public static void main(String[] args) {
String[] messages = {
"0@sn9sirppa@#?ia'jgtvryko1",
"q8e?wsellecif@#?sel@#?setuotpazdsy0*b9+mw@x1vj",
"aopi?sedohtém@#?sedhtmg+p9l!",
};
for (int i = 0; i < messages.length; i= i + 1) {
int chiffre_clé = (messages[i].length())/2;
String sous_chaîne = messages[i].substring(5, 5 + chiffre_clé);
String sous_chaînebis = sous_chaîne.replace ( "@#?", " ");
String revers = new StringBuffer(sous_chaînebis).reverse().toString();
System.out.println(revers);
};
}
}
wilder@wilder-ThinkPad-T440p:~/JavaProjects/JavaCode$ java Decipherer
j'ai appris
toutes les ficelles
des méthodes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment