https://programmers.co.kr/learn/courses/30/lessons/17686#
def seperate(file):
head = ''
number = ''
tail = ''
complete = False
idx,j = 0,0
for idx,f in enumerate(file):
if f.isdigit():
break
else:
head += f
for j, f in enumerate(file):
if j >= idx:
if f.isdigit()== False:
tail= file[j:]
break
complete = True
number +=f
else:
tail = ''
return head, number ,tail
def solution(files):
answer = []
temp = []
for file in files:
head, number, tail =seperate(file)
temp.append([head,number,tail])
temp.sort(key = lambda x : (x[0].upper(), int(x[1])))
print(temp)
for t in temp:
answer.append(''.join(t))
#
return answer