백준 #10808번 알파벳 개수

jhj·2024년 2월 9일

백준 JAVA

목록 보기
198/583
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		char[] a = new char[26];
		for(int i = 0; i < a.length; i++) {
			a[i] = (char)(97 + i);
		}
		
		String b = sc.next();
		for(int i = 0; i < a.length; i++) {
			int count = 0;
			for(int j = 0; j < b.length(); j++) {
				if(a[i] == b.charAt(j)) {
					count++;
				}
			}
			System.out.print(count + " ");
		}
		sc.close();
	}
}
profile
개발자를 꿈꾸는

0개의 댓글