Skip to content

Instantly share code, notes, and snippets.

@tachyondev
Last active December 31, 2021 16:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tachyondev/d66f4fb11bf28f037bc11e9d42734266 to your computer and use it in GitHub Desktop.
Save tachyondev/d66f4fb11bf28f037bc11e9d42734266 to your computer and use it in GitHub Desktop.
Fix the code and follow the instructions
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