[백준/BOJ] 10809 알파벳 찾기 JAVA
import java.util.Scanner;
public class BOJ_10809_알파벳찾기 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String word = sc.nextLine();
int[] words = new int[26];
for(int i=0; i<words.length; i++) {
words[i] = -1;
}
for(int i=0; i<word.length(); i++) {
int num = (word.charAt(i) - '0')-49;
if(words[num]==-1) words[num] = i;
}
for(int i=0; i<words.length; i++) {
System.out.printf("%d ", words[i]);
}
}
}
'Problem Solving' 카테고리의 다른 글
[백준/BOJ] 2577 숫자의 개수 JAVA (0) | 2020.07.06 |
---|---|
[백준/BOJ] 2565 최댓값 JAVA (0) | 2020.07.06 |
[백준/BOJ] 1110 더하기 싸이클 JAVA (0) | 2020.07.06 |
[백준/BOJ] 1929 소수구하기 C++ (0) | 2018.03.07 |
에라토스테네스의 체 (0) | 2018.03.06 |
댓글