S = eval(input())

ans = [0 for i in range(len(S) + 1)]



for i in range(len(S)):

    if "<" == S[i]:

        ans[i + 1] = ans[i] + 1



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

    if ">" == S[i]:

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



print((sum(ans)))

S = eval(input())

N = len(S) + 1

ans = [0] * N

for i in range(N - 1):

    if S[i] == "<":

        if ans[i] < ans[i + 1]:

            continue

        else:

            ans[i + 1] = ans[i] + 1



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

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

        if ans[i - 1] > ans[i]:

            continue

        else:

            ans[i - 1] = ans[i] + 1



print((sum(ans)))

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

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

-ans = [0 for i in range(len(S) + 1)] -for i in range(len(S)): -    if "<" == S[i]: -        ans[i + 1] = ans[i] + 1 -for i in range(len(S) - 1, -1, -1): -    if ">" == S[i]: -        ans[i] = max(ans[i], ans[i + 1] + 1) +N = len(S) + 1 +ans = [0] * N +for i in range(N - 1): +    if S[i] == "<": +        if ans[i] < ans[i + 1]: +            continue +        else: +            ans[i + 1] = ans[i] + 1 +for i in range(N - 1, 0, -1): +    if S[i - 1] == ">": +        if ans[i - 1] > ans[i]: +            continue +        else: +            ans[i - 1] = ans[i] + 1