-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path10809.java
32 lines (25 loc) · 840 Bytes
/
10809.java
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
import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
StringBuilder s = new StringBuilder(br.readLine());
StringBuilder res = new StringBuilder();
Map<Character, Integer>dict = new HashMap<>();
for(int i=97;i<=122;i++) {
dict.put((char)i, -1);
}
for(int i=0;i<s.length();i++) {
Character l = s.charAt(i);
if(dict.get(l)==-1) {
dict.put(l, i);
}
}
for(int i=97;i<=122;i++) {
res.append(dict.get((char)i)+" ");
}
bw.write(res.toString());
bw.flush();bw.close();
}
}