from collections import deque, defaultdict, Counter from bisect import bisect_left, bisect_right from itertools import permutations, combinations from functools import cmp_to_key, cache from heapq import heappop, heappush import math, sys import pypyjit pypyjit.set_param('max_unroll_recursion=-1') sys.setrecursionlimit(10**7) _int = lambda x: int(x)-1 MOD = 998244353 INF = 1<<62 Yes, No = "Yes", "No" S = input() N = len(S) minus = 0 stack = [] C = defaultdict(int) for i, c in enumerate(S): if c == "<": stack.append(i) elif c == ">": if stack: l = stack.pop() if C[l] > 0: minus += C[l]+2 else: stack.append(l) C[l] = -1 else: if stack: l = stack[-1] if C[l] >= 0: C[l] += 1 print(N-minus)