r = p = 0

l = [0, 0]

for c in eval(input()):

    f = c == '<'

    if c != p:

        p = c

        if f:

            r -= min(l)

            l = [0, 0]

    l[f] += 1

    r += l[f]

if not f:

    r -= min(l)

print(r)

r = l = p = lp = 0

for c in eval(input()):

    if c != p:

        if c == '<':

            r -= min(l, lp)

        p = c

        lp = l

        l = 0

    l += 1

    r += l

if p == '>':

    r -= min(l, lp)   

print(r)

r = p = 0
l = [0, 0]
for c in eval(input()):
    f = c == "<"
    if c != p:
        p = c
        if f:
            r -= min(l)
            l = [0, 0]
    l[f] += 1
    r += l[f]
if not f:
    r -= min(l)
print(r)

r = l = p = lp = 0
for c in eval(input()):
    if c != p:
        if c == "<":
            r -= min(l, lp)
        p = c
        lp = l
        l = 0
    l += 1
    r += l
if p == ">":
    r -= min(l, lp)
print(r)

-r = p = 0 -l = [0, 0] +r = l = p = lp = 0 -    f = c == "<" +        if c == "<": +            r -= min(l, lp) -        if f: -            r -= min(l) -            l = [0, 0] -    l[f] += 1 -    r += l[f] -if not f: -    r -= min(l) +        lp = l +        l = 0 +    l += 1 +    r += l +if p == ">": +    r -= min(l, lp)