from itertools import groupby



s = eval(input())

if s[-1] == '<':

    s += '>' 

r = p = 0

for k, g in groupby(s):

    s = sum(1 for _ in g)

    if k == '>':

        r += (p * p  + s * s - p - s) // 2 + max(p, s)

    p = s

print(r)

from itertools import groupby



r = p = 0

for k, g in groupby(eval(input())):

    for i, _ in enumerate(g, 1):

        r += i

    if k == '>':

        r -= min(i, p)

    p = i

print(r)

from itertools import groupby

s = eval(input())
if s[-1] == "<":
    s += ">"
r = p = 0
for k, g in groupby(s):
    s = sum(1 for _ in g)
    if k == ">":
        r += (p * p + s * s - p - s) // 2 + max(p, s)
    p = s
print(r)

from itertools import groupby

r = p = 0
for k, g in groupby(eval(input())):
    for i, _ in enumerate(g, 1):
        r += i
    if k == ">":
        r -= min(i, p)
    p = i
print(r)

-s = eval(input()) -if s[-1] == "<": -    s += ">" -for k, g in groupby(s): -    s = sum(1 for _ in g) +for k, g in groupby(eval(input())): +    for i, _ in enumerate(g, 1): +        r += i -        r += (p * p + s * s - p - s) // 2 + max(p, s) -    p = s +        r -= min(i, p) +    p = i