S = input() st = [] ans = len(S) for i,s in enumerate(S): if s == "<": st.append(0) elif s == "=": if st: st[-1] += 1 else: if not st: continue if st[-1] == 0: st.clear() else: ans -= st.pop()+2 print(ans)