import java.util.Scanner;
class JuneChallenge {
static void decipher() {
Scanner scanner = new Scanner(System.in);
int testCases = scanner.nextInt();
int decipherRules = 0, count = 0, start = 0;
char rules[] = new char[256];
char password[] = new char[1000000];
for (int i = 0; i < testCases; i++) {
for (int j = 0; j < 256; j++) {
rules[j] = '\n';
}
count = 0;
start = 0;
decipherRules = scanner.nextInt();
for (int j = 0; j < decipherRules; j++) {
rules[scanner.next().charAt(0)] = scanner.next().charAt(0);
}
password = scanner.next().toCharArray();
for (count = 0; count < password.length; count++) {
if (rules[password[count]] != '\n')
password[count] = rules[password[count]];
else
password[count] = password[count];
}
while (password[--count] == '0')
;
// encountered a decimal, decrease the index
if (password[count] == '.')
count--;
while ((password[start] == '0')) {
start++;
}
for (int k = start; k <= count; k++) {
System.out.print(password[k]);
}
}
}
public static void main(String[] args) {
/*
* JuneChallenge j = new JuneChallenge(); j.decipher();
*/
JuneChallenge.decipher();
}
}
I am getting NZEC error in the following code for "forgot password question" july challenge, not able to identify the error, any help would be appreciated.