-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathalphabat10809.java
More file actions
33 lines (31 loc) · 946 Bytes
/
Copy pathalphabat10809.java
File metadata and controls
33 lines (31 loc) · 946 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class alphabat10809 {
public static void main(String[] args)throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int[] arr = new int[26];
for(int i = 0; i < arr.length; i++){
arr[i] = -1;
}
String s = br.readLine();
//내가 푼 풀이
for(int i = 0; i < 26; i++){
for(int j = 0;j < s.length(); j++){
if((char)(97+i) == s.charAt(j)){
arr[i] = j;
break;
}
}
}
//간단 풀이
// for(int i = 0; i < s.length(); i++){
// if(arr[s.charAt(i)-'a'] == -1){
// arr[s.charAt(i)-'a']=i;
// }
// }
for(int x : arr){
System.out.print(x + " ");
}
}
}