S = eval(input())



i = 0

ans = 0

l = r = 0

while i < len(S) and S[i] == '>':

    l += 1

    i += 1

ans += l*(l+1)//2



while i < len(S):

    l = r = 0

    while i < len(S) and S[i] == '<':

        l += 1

        i += 1

    while i < len(S) and S[i] == '>':

        r += 1

        i += 1

    mx,mn = max(l,r),min(l,r)

    ans += mx*(mx+1)//2

    ans += mn*(mn-1)//2

print(ans)

S = eval(input())

ls = []

rs = []

if S[0] == '>':

    ls.append(0)

pre = None

seq = 0

for c in S:

    if c == pre:

        seq += 1

    else:

        if pre:

            if pre=='<':

                ls.append(seq)

            else:

                rs.append(seq)

        seq = 1

        pre = c

if pre=='<':

    ls.append(seq)

else:

    rs.append(seq)

if len(ls) > len(rs):

    rs.append(0)



ans = 0

for l,r in zip(ls,rs):

    if l<r: l,r = r,l

    ans += l*(l+1)//2 + r*(r-1)//2

print(ans)
S = eval(input())
i = 0
ans = 0
l = r = 0
while i < len(S) and S[i] == ">":
    l += 1
    i += 1
ans += l * (l + 1) // 2
while i < len(S):
    l = r = 0
    while i < len(S) and S[i] == "<":
        l += 1
        i += 1
    while i < len(S) and S[i] == ">":
        r += 1
        i += 1
    mx, mn = max(l, r), min(l, r)
    ans += mx * (mx + 1) // 2
    ans += mn * (mn - 1) // 2
print(ans)

S = eval(input())
ls = []
rs = []
if S[0] == ">":
    ls.append(0)
pre = None
seq = 0
for c in S:
    if c == pre:
        seq += 1
    else:
        if pre:
            if pre == "<":
                ls.append(seq)
            else:
                rs.append(seq)
        seq = 1
        pre = c
if pre == "<":
    ls.append(seq)
else:
    rs.append(seq)
if len(ls) > len(rs):
    rs.append(0)
ans = 0
for l, r in zip(ls, rs):
    if l < r:
        l, r = r, l
    ans += l * (l + 1) // 2 + r * (r - 1) // 2
print(ans)

-i = 0 +ls = [] +rs = [] +if S[0] == ">": +    ls.append(0) +pre = None +seq = 0 +for c in S: +    if c == pre: +        seq += 1 +    else: +        if pre: +            if pre == "<": +                ls.append(seq) +            else: +                rs.append(seq) +        seq = 1 +        pre = c +if pre == "<": +    ls.append(seq) +else: +    rs.append(seq) +if len(ls) > len(rs): +    rs.append(0) -l = r = 0 -while i < len(S) and S[i] == ">": -    l += 1 -    i += 1 -ans += l * (l + 1) // 2 -while i < len(S): -    l = r = 0 -    while i < len(S) and S[i] == "<": -        l += 1 -        i += 1 -    while i < len(S) and S[i] == ">": -        r += 1 -        i += 1 -    mx, mn = max(l, r), min(l, r) -    ans += mx * (mx + 1) // 2 -    ans += mn * (mn - 1) // 2 +for l, r in zip(ls, rs): +    if l < r: +        l, r = r, l +    ans += l * (l + 1) // 2 + r * (r - 1) // 2