01-09 18:44
Recent Posts
Recent Comments
๊ด€๋ฆฌ ๋ฉ”๋‰ด

miinsun

[BAEKJOON] ๋ฐฑ์ค€ ๋ฌธ์ž์—ด ์ฒ˜๋ฆฌ 10808 :: ์•ŒํŒŒ๋ฒณ ๊ฐœ์ˆ˜ JAVA ๋ณธ๋ฌธ

Algorithm/Baekjoon

[BAEKJOON] ๋ฐฑ์ค€ ๋ฌธ์ž์—ด ์ฒ˜๋ฆฌ 10808 :: ์•ŒํŒŒ๋ฒณ ๊ฐœ์ˆ˜ JAVA

miinsun 2022. 3. 15. 16:21

 

๐Ÿ’ฌ  ๋ฌธ์ œ ์„ค๋ช…

์•ŒํŒŒ๋ฒณ ์†Œ๋ฌธ์ž๋กœ๋งŒ ์ด๋ฃจ์–ด์ง„ ๋‹จ์–ด S๊ฐ€ ์ฃผ์–ด์ง„๋‹ค.
๊ฐ ์•ŒํŒŒ๋ฒณ์ด ๋‹จ์–ด์— ๋ช‡ ๊ฐœ๊ฐ€ ํฌํ•จ๋˜์–ด ์žˆ๋Š”์ง€ ๊ตฌํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•˜์‹œ์˜ค.

 

๐Ÿ”จ  ์ž…์ถœ๋ ฅ ์˜ˆ

์ž…๋ ฅ 

  • ์ฒซ์งธ ์ค„์— ๋‹จ์–ด S๊ฐ€ ์ฃผ์–ด์ง„๋‹ค. ๋‹จ์–ด์˜ ๊ธธ์ด๋Š” 100์„ ๋„˜์ง€ ์•Š์œผ๋ฉฐ, ์•ŒํŒŒ๋ฒณ ์†Œ๋ฌธ์ž๋กœ๋งŒ ์ด๋ฃจ์–ด์ ธ ์žˆ๋‹ค.
 

์ถœ๋ ฅ

  • ๋‹จ์–ด์— ํฌํ•จ๋˜์–ด ์žˆ๋Š” a์˜ ๊ฐœ์ˆ˜, b์˜ ๊ฐœ์ˆ˜, …, z์˜ ๊ฐœ์ˆ˜๋ฅผ ๊ณต๋ฐฑ์œผ๋กœ ๊ตฌ๋ถ„ํ•ด์„œ ์ถœ๋ ฅํ•œ๋‹ค.

 

์˜ˆ์ œ ์ž…๋ ฅ 1)

baekjoon

 

์˜ˆ์ œ ์ถœ๋ ฅ 1)

1 1 0 0 1 0 0 0 0 1 1 0 0 1 2 0 0 0 0 0 0 0 0 0 0 0

 

๐Ÿ’ป  Main.java

/* ๋ฐฑ์ค€ ๋ฌธ์ž์—ด ์ฒ˜๋ฆฌ - 10808 :: ์•ŒํŒŒ๋ฒณ ๊ฐœ์ˆ˜ */
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		
		int [] arr = new int [26];
		for(char c : s.toCharArray()) arr[(int) c - 'a']++;
		for(int i : arr) System.out.print(i + " "); 
		sc.close();
	}
}
Comments