S=list(input()) stack=[[S[0]]] for s in S[1:]: if s=="<": stack.append([s]) elif s=="=": if stack[-1][-1]=="<" or stack[-1][-1]=="=": stack[-1].append(s) else: stack.append([s]) else: if stack[-1][0]=="<" and stack[-1][-1]=="=": stack.pop() else: stack.append([s]) ans=[] for s in stack: ans+=s ans="".join(ans) print(len(ans))