"""
Almost no computation there, we get positions of arrows depending of their type
sorted and then do two nested loops to detect collisions, can't think of
anything better rn
"""
def answer(s):
# readme.txt
if(len(s) > 100 or len(s) < 1):
raise ValueError('Height is outside of bounds')
# we keep only the arrows and cast it into a list ot make it iterable easily
s = list(s.replace("-",""))
left = []
right = []
res=0
for i in range(0,len(s)):
if s[i] == '<':
left.append(i)
if s[i] == '>':
right.append(i)
# two nested loops to detect collision
for i in right:
for y in left:
if i < y:
res+=1
for i in left:
for y in right:
if y < i:
res+=1
return res