보라코딩
백준 추천문제 본문
프로그래머스만 풀다가 백준 풀면
방법이 좀 다름!
문제집: 자가비의 추천문제#1 (zagabi)
www.acmicpc.net
[Algorithm] 백준 문제 추천
devjeong.com
GitHub - tony9402/baekjoon: 코딩테스트 대비 문제집(Baekjoon Online Judge)
코딩테스트 대비 문제집(Baekjoon Online Judge). Contribute to tony9402/baekjoon development by creating an account on GitHub.
github.com
알파벳 개수
- main 메서드에
- scanner로 받아오게
- System.out.print 방식으로 제출
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String S = scanner.next();
int[] answer = new int[26];
char[] sChar = S.toCharArray();
for (int i = 0; i < sChar.length; i++){
int number = sChar[i];
answer[number-'a']++;
}
for(int i : answer){
System.out.print(i + " ");
}
}
}
'백준(java)' 카테고리의 다른 글
백준 :: 완전탐색 (0) | 2024.01.16 |
---|---|
백준 :: 그리디 (0) | 2024.01.02 |
백준 :: 구간 합 구하기 4 (0) | 2023.07.15 |
백준 :: 평균 구하기 (0) | 2023.07.13 |
백준 :: 숫자의 합 구하기 (0) | 2023.07.12 |