S = eval(input())



lst = [1 if S[0]=='<' else -1]

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

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

        lst[-1] += 1 if S[i]=='<' else -1

    else:

        lst.append(-1 if S[i]=='>' else 1)

        

ans = [0]



for i in lst:

    if i > 0:

        ans += list(range(1,i+1))

    else:

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

        ans += list(range(-i-1,-1, -1))





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



lst = [1 if S[0]=='<' else -1]

pre = S[0]

for i in S[1:]:

    if i == pre:

        lst[-1] += 1 if i=='<' else -1

    else:

        lst.append(-1 if i=='>' else 1)

    pre = i    

ans = [0]



for i in lst:

    if i > 0:

        ans += list(range(1,i+1))

    else:

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

        ans += list(range(-i-1,-1, -1))



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

S = eval(input())
lst = [1 if S[0] == "<" else -1]
pre = S[0]
for i in S[1:]:
    if i == pre:
        lst[-1] += 1 if i == "<" else -1
    else:
        lst.append(-1 if i == ">" else 1)
    pre = i
ans = [0]
for i in lst:
    if i > 0:
        ans += list(range(1, i + 1))
    else:
        ans[-1] = max(ans[-1], -i)
        ans += list(range(-i - 1, -1, -1))
print((sum(ans)))

-for i in range(1, len(S)): -    if S[i] == S[i - 1]: -        lst[-1] += 1 if S[i] == "<" else -1 +pre = S[0] +for i in S[1:]: +    if i == pre: +        lst[-1] += 1 if i == "<" else -1 -        lst.append(-1 if S[i] == ">" else 1) +        lst.append(-1 if i == ">" else 1) +    pre = i