Beakjoon&프로그래머스/Java
[프로그래머스/Java] 문자 개수 세기
현장
2025. 2. 11. 18:46
-Code
class Solution {
public int[] solution(String my_string) {
int[] answer = new int[52];
for (char w : my_string.toCharArray()) {
answer[w - 'A' - (Character.isUpperCase(w) ? 0 : 6)] += 1;
}
return answer;
}
}