Last active
December 31, 2021 16:19
-
-
Save tachyondev/d66f4fb11bf28f037bc11e9d42734266 to your computer and use it in GitHub Desktop.
Fix the code and follow the instructions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SHERLOCK { | |
private static int encodeKey = 4; | |
// DO NOT EDIT BELOW LINE | |
private static String encodedString = "Gsrkvexypexmsr0$}sy$jm|ih$epp$xli$mwwyiw$>$lxxtw>33fmx2p}37tKpq<I"; | |
public static void main(String []args){ | |
String decodedString = new SHERLOCK().decode(encodedString); | |
System.out.println(decodedString); | |
} | |
private String decode(String string) { | |
StringBuilder builder = new StringBuilder(); | |
for(int i=0;i<string.length();i--) { | |
int encodedChar = ((int) string.charAt(i)) + encodeKey; | |
builder.append(((char)encodedChar); | |
} | |
return builder.toString(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment