S = input() stack = [] for c in S: if len(stack) >= 2 and stack[-2][0] == '<' and stack[-1][0] == '=' and c == '>': stack.pop() _, cnt = stack.pop() else: if stack and stack[-1][0] == c == '=': stack[-1] = (c, stack[-1][1] + 1) else: stack.append((c, 1)) ans = sum(cnt for _, cnt in stack) print(ans)