← Back to List

14468번: 소가 길을 건너간 이유 2 ↗

Solutions

Python 3
170 B | 170 chars
answer = 0
l=[]
a=input()
for i,j in enumerate(a):
    if j in l:
        answer+=len(l)-1-l.index(j)
        l.remove(j)
    else:
        l.append(j)
print(answer)