"""input""" #int-input # input = sys.stdin.readline def II(): return int(input()) def MI(): return map(int, input().split()) def LI(): return list(MI()) #str-input def SI(): return input() def MSI(): return input().split() def SI_L(): return list(SI()) def SI_LI(): return list(map(int, SI())) #multiple-input def LLI(n): return [LI() for _ in range(n)] def LSI(n): return [SI() for _ in range(n)] #1-indexを0-indexでinput def MI_1(): return map(lambda x:int(x)-1, input().split()) def TI_1(): return tuple(MI_1()) def LI_1(): return list(MI_1()) class dsu(): n=1 parent_or_size=[-1 for i in range(n)] def __init__(self,N): self.n=N self.parent_or_size=[-1 for i in range(N)] def merge(self,a,b): assert 0<=a0: result2.append(result[i]) return result2 s = SI() n = len(s) st = [] for i in range(n): if s[i] == "<": st.append([0,1]) elif s[i] == ">": st.append([2,1]) else: if st and st[-1][0] == 1: st[-1][1] += 1 else: st.append([1,1]) if len(st) < 3: continue if st[-3][0] == 0 and st[-2][0] == 1 and st[-1][0] == 2: st.pop() st.pop() st.pop() ans = sum(c for i,c in st) print(ans) # n,k = MI() # h = LI() # p = LLI(n) # uf = dsu(n) # def dis(p,q): # return (p[0]-q[0])**2 + (p[1]-q[1])**2 # edge = [set() for i in range(n)] # for i in range(n): # for j in range(n): # if h[i] < h[j] and dis(p[i],p[j]) <= k**2: # edge[i].add(j) # ans = 0 # for i in range(n): # if edge[i] == set(): # ans += 1 # print(ans)