Last active
June 4, 2020 01:16
-
-
Save honux77/7ac5a4d8884827db275c024494810417 to your computer and use it in GitHub Desktop.
BOJ 10809
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
s = input() | |
# wrong ab = "abcdefghijklmnopqrstuvxwyz" | |
ab = "abcdefghijklmnopqrstuvwxyz" | |
ans = [-1] * len(ab) | |
for i in range(len(s)): | |
for j in range(len(ab)): | |
if s[i] == ab[j] and ans[j] == -1: | |
ans[j] = i | |
print(" ".join(map(str,ans))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
s = input() | |
ans = [-1] * 26 | |
a = ord('a') | |
for i in range(len(s)): | |
if ans[ord(s[i]) - a] == -1: | |
ans[ord(s[i]) - a] = i | |
print(" ".join(map(str,ans))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
알파벳 순서 틀려서 틀렸다고 베이버님이 제보해줌 ㅜㅜ.