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 l = 0 left_list = [] # right_list = [] last_left = None last_right = None start_r = None while l < len(s): if s[l] == '<': mid_flg = False if start_r is None: r = l + 1 elif l > start_r: r = l + 1 start_r = None else: r = start_r while r < len(s): if s[r] == '=': mid_flg = True elif s[r] == '>': if mid_flg: ans -= (r-l+1) if last_left is not None and l < last_left and last_right < r: ans += last_right-last_left+1 last_left = l last_right = r start_r = r + 1 if left_list: l = left_list.pop() else: l = r + 1 break else: l = r + 1 break else: left_list.append(l) l = r break r += 1 l += 1 print(ans)