why does my code fail? It fails on the chatAt function upon the second rotation of the for loop.
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = Integer.parseInt(scanner.nextLine());
int sum = 0;
for (int i = 0; i <n ; i++) {{
String letter = scanner.nextLine();
char valueOf = letter.charAt(i);
int valueto = (int)valueOf;
sum += valueto;
}
}
System.out.println(sum);
}
}