import sys, math sys.setrecursionlimit(10**7) from itertools import * from heapq import heapify, heappush, heappop from collections import deque, defaultdict, Counter from bisect import bisect_left, bisect_right from copy import copy, deepcopy # from sortedcontainers import SortedSet, SortedList, SortedDict INF, LINF, ipt = float('inf'), 1 << 60, sys.stdin.readline iin, mii = lambda: int(ipt()), lambda: map(int, ipt().split()) lmi = lambda: list(map(int, ipt().split())) S = input() N = len(S) st = deque() ans = N for i in range(N): if S[i] == "<": st.append(1) elif S[i] == "=": st.append(0) else: cnt = 0 while st and st[-1] == 0: cnt += 1 st.pop() if cnt == 0: st.append(-1) continue if st and st[-1] == 1: ans -= cnt + 2 st.pop() else: st.append(-1) print(ans)