Я пытаюсь расшифровать Vigenere_Cipher при вводе BEXR TKGKTRQFARI
, вывод JAVAPROGRAMMING
Но я хочу поставить пробел, как JAVA PROGRAMMING
.
Мой код
public static String VigenereDecipher(String text) {
String keyword = "SECRET";
String decipheredText = "";
text = text.toUpperCase();
for (int i = 0, j = 0; i < text.length(); i++) {
char c = text.charAt(i);
if (c < 'A' || c > 'Z') continue;
decipheredText += (char)((c - keyword.charAt(j) + 26) % 26 + 'A');
j = ++j % keyword.length();
}
return decipheredText;
}