S = list(eval(input()))

N = len(S) + 1



ans_l = [-1] * N

ans_l[0] = 0

combo = 0

for i in range(N - 1):

    if S[i] == '<':

        combo += 1

    else:

        combo = 0

    ans_l[i + 1] = combo



ans_r = [-1] * N

ans_r[-1] = 0

combo = 0

for j in range(N - 1):

    i = N - 2 - j

    if S[i] == '>':

        combo += 1

    else:

        combo = 0

    ans_r[i] = combo



# print("#", ans_l)

# print("#", ans_r)

ans = [max(tmp_l, tmp_r) for tmp_l, tmp_r in zip(ans_l, ans_r)]



print((sum(ans)))
S = eval(input())

N = len(S) + 1



a_left = [0] * N

a_tmp = 0

for i in range(N - 1):

    if S[i] == '<':

        a_tmp += 1

    else:

        a_tmp = 0

    #

    a_left[i + 1] = a_tmp



a_right = [0] * N

a_tmp = 0

for i in range(N - 1):

    if S[-1 - i] == '>':

        a_tmp += 1

    else:

        a_tmp = 0

    #

    a_right[-2 - i] = a_tmp

        

a_ans = [max(li, ri) for li, ri in zip(a_left, a_right)]



print((sum(a_ans)))
S = list(eval(input()))
N = len(S) + 1
ans_l = [-1] * N
ans_l[0] = 0
combo = 0
for i in range(N - 1):
    if S[i] == "<":
        combo += 1
    else:
        combo = 0
    ans_l[i + 1] = combo
ans_r = [-1] * N
ans_r[-1] = 0
combo = 0
for j in range(N - 1):
    i = N - 2 - j
    if S[i] == ">":
        combo += 1
    else:
        combo = 0
    ans_r[i] = combo
# print("#", ans_l)
# print("#", ans_r)
ans = [max(tmp_l, tmp_r) for tmp_l, tmp_r in zip(ans_l, ans_r)]
print((sum(ans)))

S = eval(input())
N = len(S) + 1
a_left = [0] * N
a_tmp = 0
for i in range(N - 1):
    if S[i] == "<":
        a_tmp += 1
    else:
        a_tmp = 0
    #
    a_left[i + 1] = a_tmp
a_right = [0] * N
a_tmp = 0
for i in range(N - 1):
    if S[-1 - i] == ">":
        a_tmp += 1
    else:
        a_tmp = 0
    #
    a_right[-2 - i] = a_tmp
a_ans = [max(li, ri) for li, ri in zip(a_left, a_right)]
print((sum(a_ans)))

-S = list(eval(input())) +S = eval(input()) -ans_l = [-1] * N -ans_l[0] = 0 -combo = 0 +a_left = [0] * N +a_tmp = 0 -        combo += 1 +        a_tmp += 1 -        combo = 0 -    ans_l[i + 1] = combo -ans_r = [-1] * N -ans_r[-1] = 0 -combo = 0 -for j in range(N - 1): -    i = N - 2 - j -    if S[i] == ">": -        combo += 1 +        a_tmp = 0 +    # +    a_left[i + 1] = a_tmp +a_right = [0] * N +a_tmp = 0 +for i in range(N - 1): +    if S[-1 - i] == ">": +        a_tmp += 1 -        combo = 0 -    ans_r[i] = combo -# print("#", ans_l) -# print("#", ans_r) -ans = [max(tmp_l, tmp_r) for tmp_l, tmp_r in zip(ans_l, ans_r)] -print((sum(ans))) +        a_tmp = 0 +    # +    a_right[-2 - i] = a_tmp +a_ans = [max(li, ri) for li, ri in zip(a_left, a_right)] +print((sum(a_ans)))