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