I don't understand this code
print(*map(input().find,map(chr,range(97,123))))
This code is written by someone to find the position of each character's (a - z) first appearance when the user type in words. And if the character is not consisted in the word the position will be -1.
so for example if the input is
baekjoon
the output will be
1 0 -1 -1 2 -1 -1 -1 -1 4 3 -1 -1 7 5 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
`I've written code for this but it is really long compared to the one at the top
a = [i for i in input()]
result = 0
for i in range(ord('a'), ord('z')+1):
for j in range(len(a)):
if i == ord(a[j]):
result = j
break
else:
result = -1
print(result, end=" ")
With this code i get the same output but i think it's not well written code. So i really want to understand this code to improve my coding skill
print(*map(input().find,map(chr,range(97,123))))
what does that star do in front of map function and i just don't know what how that code works.