S = list(eval(input()))

numList = [0] * (len(S) + 1)

for i in range(len(S)):

    if S[i] == '<':

        numList[i + 1] = numList[i] + 1



for i in range(len(S) - 1 , -1 , -1):

    if S[i] == '>':

        numList[i] = max(numList[i + 1] + 1 ,numList[i])

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

ans_list = [0] * (len(S) + 1)

for i in range(len(S)):

    if S[i] == '<':

        ans_list[i + 1] = ans_list[i] + 1



for i in range(len(S) - 1,-1,-1):

    if S[i] == '>':

        ans_list[i] = max(ans_list[i + 1] + 1, ans_list[i])



print((sum(ans_list)))
S = list(eval(input()))
numList = [0] * (len(S) + 1)
for i in range(len(S)):
    if S[i] == "<":
        numList[i + 1] = numList[i] + 1
for i in range(len(S) - 1, -1, -1):
    if S[i] == ">":
        numList[i] = max(numList[i + 1] + 1, numList[i])
print((sum(numList)))

S = eval(input())
ans_list = [0] * (len(S) + 1)
for i in range(len(S)):
    if S[i] == "<":
        ans_list[i + 1] = ans_list[i] + 1
for i in range(len(S) - 1, -1, -1):
    if S[i] == ">":
        ans_list[i] = max(ans_list[i + 1] + 1, ans_list[i])
print((sum(ans_list)))

-S = list(eval(input())) -numList = [0] * (len(S) + 1) +S = eval(input()) +ans_list = [0] * (len(S) + 1) -        numList[i + 1] = numList[i] + 1 +        ans_list[i + 1] = ans_list[i] + 1 -        numList[i] = max(numList[i + 1] + 1, numList[i]) -print((sum(numList))) +        ans_list[i] = max(ans_list[i + 1] + 1, ans_list[i]) +print((sum(ans_list)))