iDropped my alph in hot oil
All checks were successful
Deploy / trigger (push) Successful in 24s

Signed-off-by: Francesco Mancuso <hello@francescomancuso.it>
This commit is contained in:
2026-04-21 13:55:31 +02:00
parent 8c23a08e2a
commit 6477512940

View File

@@ -6,7 +6,7 @@ public class Caesar {
char encoded[] = plaintext.toCharArray(); char encoded[] = plaintext.toCharArray();
for(int i = 0; i < plaintext.length(); i++){ for(int i = 0; i < plaintext.length(); i++){
if (encoded[i] == ' ') continue; if (alphabet.indexOf(encoded[i]) == -1) continue;
encoded[i] = alphabet.charAt((alphabet.indexOf(encoded[i]) + key) % 26); encoded[i] = alphabet.charAt((alphabet.indexOf(encoded[i]) + key) % 26);
} }
return String.valueOf(encoded); return String.valueOf(encoded);
@@ -22,7 +22,7 @@ public class Caesar {
for(int key = 0; key < alphabet.length(); key++){ for(int key = 0; key < alphabet.length(); key++){
for(int i = 0; i < ciphertext.length(); i++){ for(int i = 0; i < ciphertext.length(); i++){
if (encoded[i] == ' ') { if (alphabet.indexOf(encoded[i]) == -1) {
decoded[i] = encoded[i]; decoded[i] = encoded[i];
continue; continue;
} }