코딩/백준 알고리즘

10808번) 알파벳 개수

금손형아 2017. 11. 11. 15:47

문제 출처 : https://www.acmicpc.net/problem/10808



import java.util.Scanner;


public class Q10808 {


public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

String string = sc.nextLine();

int[] alphabet = new int[26];

for ( int i = 0; i < string.length(); i++ ) {

int temp = Integer.valueOf(string.charAt(i)) - 97;

alphabet[temp]++;

}

for ( int i = 0; i < 26; i++ ) {

System.out.print(alphabet[i] + " ");

}


}

}