S = eval(input())

ans = 0

a = []

up = True

count = 0

for i in S:

    if up:

        if i == '>':

            a.append(count)

            count = 1

            up = False

        else:

            count += 1

    else:

        if i == '<':

            a.append(count)

            count = 1

            up = True

        else:

            count += 1

a.append(count)

if len(a)%2 == 1:

    a.append(0)

for i in range(0,len(a),2):

    u,d = max(a[i],a[i+1]), min(a[i],a[i+1])-1

    ans += u*(u+1)//2 + d*(d+1)//2

print(ans)

    
S = input().replace('><','> <').split()

ans = 0

for s in S:

    up = s.count('<')

    down = len(s)-up

    if up < down:

        up -= 1

        ans += up*(up+1)//2 + down*(down+1)//2

    else:

        down -= 1

        ans += up*(up+1)//2 + down*(down+1)//2        

print(ans)
S = eval(input())
ans = 0
a = []
up = True
count = 0
for i in S:
    if up:
        if i == ">":
            a.append(count)
            count = 1
            up = False
        else:
            count += 1
    else:
        if i == "<":
            a.append(count)
            count = 1
            up = True
        else:
            count += 1
a.append(count)
if len(a) % 2 == 1:
    a.append(0)
for i in range(0, len(a), 2):
    u, d = max(a[i], a[i + 1]), min(a[i], a[i + 1]) - 1
    ans += u * (u + 1) // 2 + d * (d + 1) // 2
print(ans)

S = input().replace("><", "> <").split()
ans = 0
for s in S:
    up = s.count("<")
    down = len(s) - up
    if up < down:
        up -= 1
        ans += up * (up + 1) // 2 + down * (down + 1) // 2
    else:
        down -= 1
        ans += up * (up + 1) // 2 + down * (down + 1) // 2
print(ans)

-S = eval(input()) +S = input().replace("><", "> <").split() -a = [] -up = True -count = 0 -for i in S: -    if up: -        if i == ">": -            a.append(count) -            count = 1 -            up = False -        else: -            count += 1 +for s in S: +    up = s.count("<") +    down = len(s) - up +    if up < down: +        up -= 1 +        ans += up * (up + 1) // 2 + down * (down + 1) // 2 -        if i == "<": -            a.append(count) -            count = 1 -            up = True -        else: -            count += 1 -a.append(count) -if len(a) % 2 == 1: -    a.append(0) -for i in range(0, len(a), 2): -    u, d = max(a[i], a[i + 1]), min(a[i], a[i + 1]) - 1 -    ans += u * (u + 1) // 2 + d * (d + 1) // 2 +        down -= 1 +        ans += up * (up + 1) // 2 + down * (down + 1) // 2