Concerto de lógica simples
adicionado .toLowerCase() para que strings com caracteres maiusculos nao sejam detectados como default
This commit is contained in:
@@ -35,7 +35,7 @@ public class BotsEncrypter {
|
|||||||
int contador = 0;
|
int contador = 0;
|
||||||
String encodedword[] = new String[input.length()];
|
String encodedword[] = new String[input.length()];
|
||||||
for (int i = 0; i < input.length(); i++) {
|
for (int i = 0; i < input.length(); i++) {
|
||||||
switch(input.charAt(i)){
|
switch(input.toLowerCase().charAt(i)){
|
||||||
case 'a' -> encodedword[i] = "0";
|
case 'a' -> encodedword[i] = "0";
|
||||||
case 'b' -> encodedword[i] = "1";
|
case 'b' -> encodedword[i] = "1";
|
||||||
case 'c' -> encodedword[i] = "2";
|
case 'c' -> encodedword[i] = "2";
|
||||||
@@ -79,7 +79,7 @@ public class BotsEncrypter {
|
|||||||
String input = scn.nextLine();
|
String input = scn.nextLine();
|
||||||
String decodedword[] = new String[input.length()];
|
String decodedword[] = new String[input.length()];
|
||||||
for (int i = 0; i < input.length(); i++) {
|
for (int i = 0; i < input.length(); i++) {
|
||||||
switch(input.charAt(i)){
|
switch(input.toLowerCase().charAt(i)){
|
||||||
case '0' -> decodedword[i] = "a";
|
case '0' -> decodedword[i] = "a";
|
||||||
case '1' -> decodedword[i] = "b";
|
case '1' -> decodedword[i] = "b";
|
||||||
case '2' -> decodedword[i] = "c";
|
case '2' -> decodedword[i] = "c";
|
||||||
|
|||||||
Reference in New Issue
Block a user