S = eval(input())

N = len(S) + 1

a = [0] * N



for i in range(-1, N-1):

    if (i == -1 and S[i+1] == '<') or (i == N - 2 and S[i] == '>') or (S[i] == '>' and S[i+1] == '<'):

        j = 0

        while i - j >= 0 and S[i-j] == '>' and a[i-j] < j + 1:

            a[i-j] = j + 1

            j += 1

        j = 0

        while i + 2 + j < N and S[i+1+j] == '<' and a[i+2+j] < j + 1:

            a[i+2+j] = j + 1

            j += 1

print((sum(a)))

S = '>' + eval(input()) + '<'

N = len(S) + 1

a = [0] * N



for i in range(N - 1):

    if S[i] == '>' and S[i+1] == '<':

        j = 0

        while i - j >= 0 and S[i-j] == '>' and a[i-j] < j + 1:

            a[i-j] = j + 1

            j += 1

        j = 0

        while i + 2 + j < N and S[i+1+j] == '<' and a[i+2+j] < j + 1:

            a[i+2+j] = j + 1

            j += 1

print((sum(a) - a[0] - a[-1]))

S = eval(input())
N = len(S) + 1
a = [0] * N
for i in range(-1, N - 1):
    if (
        (i == -1 and S[i + 1] == "<")
        or (i == N - 2 and S[i] == ">")
        or (S[i] == ">" and S[i + 1] == "<")
    ):
        j = 0
        while i - j >= 0 and S[i - j] == ">" and a[i - j] < j + 1:
            a[i - j] = j + 1
            j += 1
        j = 0
        while i + 2 + j < N and S[i + 1 + j] == "<" and a[i + 2 + j] < j + 1:
            a[i + 2 + j] = j + 1
            j += 1
print((sum(a)))

S = ">" + eval(input()) + "<"
N = len(S) + 1
a = [0] * N
for i in range(N - 1):
    if S[i] == ">" and S[i + 1] == "<":
        j = 0
        while i - j >= 0 and S[i - j] == ">" and a[i - j] < j + 1:
            a[i - j] = j + 1
            j += 1
        j = 0
        while i + 2 + j < N and S[i + 1 + j] == "<" and a[i + 2 + j] < j + 1:
            a[i + 2 + j] = j + 1
            j += 1
print((sum(a) - a[0] - a[-1]))

-S = eval(input()) +S = ">" + eval(input()) + "<" -for i in range(-1, N - 1): -    if ( -        (i == -1 and S[i + 1] == "<") -        or (i == N - 2 and S[i] == ">") -        or (S[i] == ">" and S[i + 1] == "<") -    ): +for i in range(N - 1): +    if S[i] == ">" and S[i + 1] == "<": -print((sum(a))) +print((sum(a) - a[0] - a[-1]))