What is the purpose of this code segment?
int[] counts = new int[26];
for (char c : word.toCharArray()) {
if (c >= 'a' && c <= 'z') {
counts[c - 'a']++;
}
}
What is the purpose of this code segment?
int[] counts = new int[26];
for (char c : word.toCharArray()) {
if (c >= 'a' && c <= 'z') {
counts[c - 'a']++;
}
}