Skip to content

Instantly share code, notes, and snippets.

@honux77
Last active June 4, 2020 01:16
Show Gist options
  • Save honux77/7ac5a4d8884827db275c024494810417 to your computer and use it in GitHub Desktop.
Save honux77/7ac5a4d8884827db275c024494810417 to your computer and use it in GitHub Desktop.
BOJ 10809
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)))
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)))
@honux77
Copy link
Author

honux77 commented Jun 4, 2020

알파벳 순서 틀려서 틀렸다고 베이버님이 제보해줌 ㅜㅜ.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment