|
|
@@ -1,13 +1,13 @@
|
|
1
|
1
|
import java.util.ArrayList;
|
|
2
|
2
|
import java.util.List;
|
|
3
|
3
|
|
|
4
|
|
-public class Atbash {
|
|
|
4
|
+class Atbash {
|
|
5
|
5
|
|
|
6
|
6
|
private static final int GROUP_SIZE = 5;
|
|
7
|
7
|
private static final String PLAIN = "abcdefghijklmnopqrstuvwxyz";
|
|
8
|
8
|
private static final String CIPHER = "zyxwvutsrqponmlkjihgfedcba";
|
|
9
|
9
|
|
|
10
|
|
- public String encode(String input) {
|
|
|
10
|
+ String encode(String input) {
|
|
11
|
11
|
String encoded = stripInvalidCharacters(input).toLowerCase();
|
|
12
|
12
|
String cyphered = "";
|
|
13
|
13
|
|
|
|
@@ -18,7 +18,7 @@ public class Atbash {
|
|
18
|
18
|
return splitIntoFiveLetterWords(cyphered);
|
|
19
|
19
|
}
|
|
20
|
20
|
|
|
21
|
|
- public String decode(String input) {
|
|
|
21
|
+ String decode(String input) {
|
|
22
|
22
|
String encoded = stripInvalidCharacters(input).toLowerCase();
|
|
23
|
23
|
String deciphered = "";
|
|
24
|
24
|
|
|
|
@@ -29,7 +29,7 @@ public class Atbash {
|
|
29
|
29
|
return deciphered;
|
|
30
|
30
|
}
|
|
31
|
31
|
|
|
32
|
|
- private String stripInvalidCharacters(String input) {
|
|
|
32
|
+ String stripInvalidCharacters(String input) {
|
|
33
|
33
|
String filteredValue = "";
|
|
34
|
34
|
|
|
35
|
35
|
for (char c : input.toCharArray()) {
|