s=list(eval(input()))

n=len(s)

#print(s)

num=[]

def search(now,kigo): #自分より右に何回同じ記号が続くか

    global s,n

    count=0

    while s[now]==kigo:

        now+=1

        count+=1

        if now==n:

            break

    return count

where=0

left=0

if s[0]=="<":

    a=search(0,"<")

    nn=0

    for i in range(a):

        num.append(nn)

        if i==a-1:

            break

        nn+=1

    left=nn

else:

    a=search(0,">")

    nn=a

    for i in range(a):

        num.append(nn)

        nn-=1

    left=1

where=a #次調べる場所

while where<=n-1:

    if s[where]=="<":

        a=search(where,"<")

        nn=0

        for i in range(a):

            num.append(nn)

            if i==a-1:

                break

            nn+=1

        left=nn

    else:

        a=search(where,">")

        if left<a:

            nn=a

        else:

            nn=left+1

        num.append(nn)

        nnn=a-1

        for i in range(a-1):

            num.append(nnn)

            nnn-=1

        left=1

    where+=a

    #print(a)

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

    num.append(left+1)

else:

    num.append(left-1)

#print(num)

print((sum(num)))
s=list(eval(input()))

n=len(s)

l=[0] #自分より左にある＜の数

r=[0] #自分より右にある＞の数

l_num=0

r_num=0

for i in range(n):

    if s[i]=="<":

        l_num+=1

    else:

        l_num=0

    if s[-(i+1)]==">":

        r_num+=1

    else:

        r_num=0

    l.append(l_num)

    r.append(r_num)

ans=0

for i in range(n+1):

    ans+=max(l[i],r[-(i+1)])

print(ans)
s = list(eval(input()))
n = len(s)
# print(s)
num = []


def search(now, kigo):  # 自分より右に何回同じ記号が続くか
    global s, n
    count = 0
    while s[now] == kigo:
        now += 1
        count += 1
        if now == n:
            break
    return count


where = 0
left = 0
if s[0] == "<":
    a = search(0, "<")
    nn = 0
    for i in range(a):
        num.append(nn)
        if i == a - 1:
            break
        nn += 1
    left = nn
else:
    a = search(0, ">")
    nn = a
    for i in range(a):
        num.append(nn)
        nn -= 1
    left = 1
where = a  # 次調べる場所
while where <= n - 1:
    if s[where] == "<":
        a = search(where, "<")
        nn = 0
        for i in range(a):
            num.append(nn)
            if i == a - 1:
                break
            nn += 1
        left = nn
    else:
        a = search(where, ">")
        if left < a:
            nn = a
        else:
            nn = left + 1
        num.append(nn)
        nnn = a - 1
        for i in range(a - 1):
            num.append(nnn)
            nnn -= 1
        left = 1
    where += a
    # print(a)
if s[-1] == "<":
    num.append(left + 1)
else:
    num.append(left - 1)
# print(num)
print((sum(num)))

s = list(eval(input()))
n = len(s)
l = [0]  # 自分より左にある＜の数
r = [0]  # 自分より右にある＞の数
l_num = 0
r_num = 0
for i in range(n):
    if s[i] == "<":
        l_num += 1
    else:
        l_num = 0
    if s[-(i + 1)] == ">":
        r_num += 1
    else:
        r_num = 0
    l.append(l_num)
    r.append(r_num)
ans = 0
for i in range(n + 1):
    ans += max(l[i], r[-(i + 1)])
print(ans)

-# print(s) -num = [] - - -def search(now, kigo):  # 自分より右に何回同じ記号が続くか -    global s, n -    count = 0 -    while s[now] == kigo: -        now += 1 -        count += 1 -        if now == n: -            break -    return count - - -where = 0 -left = 0 -if s[0] == "<": -    a = search(0, "<") -    nn = 0 -    for i in range(a): -        num.append(nn) -        if i == a - 1: -            break -        nn += 1 -    left = nn -else: -    a = search(0, ">") -    nn = a -    for i in range(a): -        num.append(nn) -        nn -= 1 -    left = 1 -where = a  # 次調べる場所 -while where <= n - 1: -    if s[where] == "<": -        a = search(where, "<") -        nn = 0 -        for i in range(a): -            num.append(nn) -            if i == a - 1: -                break -            nn += 1 -        left = nn +l = [0]  # 自分より左にある＜の数 +r = [0]  # 自分より右にある＞の数 +l_num = 0 +r_num = 0 +for i in range(n): +    if s[i] == "<": +        l_num += 1 -        a = search(where, ">") -        if left < a: -            nn = a -        else: -            nn = left + 1 -        num.append(nn) -        nnn = a - 1 -        for i in range(a - 1): -            num.append(nnn) -            nnn -= 1 -        left = 1 -    where += a -    # print(a) -if s[-1] == "<": -    num.append(left + 1) -else: -    num.append(left - 1) -# print(num) -print((sum(num))) +        l_num = 0 +    if s[-(i + 1)] == ">": +        r_num += 1 +    else: +        r_num = 0 +    l.append(l_num) +    r.append(r_num) +ans = 0 +for i in range(n + 1): +    ans += max(l[i], r[-(i + 1)]) +print(ans)