S = input() stack = [] idxL = [] idxR = [] for i in range(len(S)): if S[i] == "<": stack.append(S[i]) idxL.append(i) elif S[i] == "=": stack.append(S[i]) else: if (len(stack) >= 1 and stack[-1] == "=" and (len(idxL) >= 1 and len(idxR) == 0 or len(idxL) >= 1 and len(idxR) >= 1 and idxL[-1] > idxR[-1])): idxL.pop() while stack[-1] == "=": stack.pop() stack.pop() else: stack.append(S[i]) idxR.append(i) print(len(stack))