import sys def debug(*args): print(*args, file=sys.stderr) s = input() ans = len(s) left_list = [] right_list = [] i = 0 mid_flg = False # add = 0 last_left = None last_right = None for i in range(len(s)): if s[i] == '<': left_list.append(i) mid_flg = False elif s[i] == '=': mid_flg = True else: if mid_flg and left_list and (not right_list or left_list[-1] > right_list[-1]): l = left_list.pop() ans -= (i-l+1) if last_left is not None and l < last_left: ans += last_right-last_left+1 debug(i, l, ans) last_left = l last_right = i if l > 0 and s[l-1] == '=': mid_flg = True else: mid_flg = False else: right_list.append(i) mid_flg = False print(ans)