백준 - 10809 알파벳 찾기
문제
10809 알파벳 찾기
답
kotlin code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import java.util.*
fun main() {
q10809()
}
fun q10809() = with(Scanner(System.`in`)) {
val input = next();
val inputs = input.toCharArray().map { it.code }
for(alphabet in 'a'.code .. 'z'.code) {
if(!inputs.contains(alphabet)) {
print("-1 ")
continue
}
for (index in inputs.indices) {
if(alphabet == inputs[index]) {
print("$index ")
break
}
}
}
}
This post is licensed under CC BY 4.0 by the author.