n=int(input()) s=input() p=0 a=[0]*n for c in s: if c=='+': a[p]+=1 if c=='-': a[p]-=1 p+=(c=='>')-(c=='<') if not 0<=p