s = str(eval(input()))

n = len(s)

l = [0]*(n+1)

temp = 0

for i in range(n):

  if s[i] == '<':

    temp += 1

    l[i+1] = temp

  else:

    temp = 0

    l[i+1] = temp



r = [0]*(n+1)

temp = 0

for i in reversed(list(range(n))):

  if s[i] == '>':

    temp += 1

    r[i] = temp

  else:

    temp = 0

    r[i] = temp

#print(l)

#print(r)

ans = [0]*(n+1)

for i in range(n+1):

  ans[i] = max(l[i], r[i])

#print(ans)

print((sum(ans)))
s = str(eval(input()))

n = len(s)

cnt = 0

l = []

for i in range(n):

    l.append(cnt)

    if s[i] == '<':

        cnt += 1

    else:

        cnt = 0

else:

    l.append(cnt)

#print(l)



r = []

cnt = 0

for i in reversed(list(range(n))):

    r.append(cnt)

    if s[i] == '>':

        cnt += 1

    else:

        cnt = 0

else:

    r.append(cnt)

r.reverse()

#print(r)



A = [0]*len(l)

for i in range(len(A)):

    A[i] = max(l[i], r[i])

print((sum(A)))

s = str(eval(input()))
n = len(s)
l = [0] * (n + 1)
temp = 0
for i in range(n):
    if s[i] == "<":
        temp += 1
        l[i + 1] = temp
    else:
        temp = 0
        l[i + 1] = temp
r = [0] * (n + 1)
temp = 0
for i in reversed(list(range(n))):
    if s[i] == ">":
        temp += 1
        r[i] = temp
    else:
        temp = 0
        r[i] = temp
# print(l)
# print(r)
ans = [0] * (n + 1)
for i in range(n + 1):
    ans[i] = max(l[i], r[i])
# print(ans)
print((sum(ans)))

s = str(eval(input()))
n = len(s)
cnt = 0
l = []
for i in range(n):
    l.append(cnt)
    if s[i] == "<":
        cnt += 1
    else:
        cnt = 0
else:
    l.append(cnt)
# print(l)
r = []
cnt = 0
for i in reversed(list(range(n))):
    r.append(cnt)
    if s[i] == ">":
        cnt += 1
    else:
        cnt = 0
else:
    r.append(cnt)
r.reverse()
# print(r)
A = [0] * len(l)
for i in range(len(A)):
    A[i] = max(l[i], r[i])
print((sum(A)))

-l = [0] * (n + 1) -temp = 0 +cnt = 0 +l = [] +    l.append(cnt) -        temp += 1 -        l[i + 1] = temp +        cnt += 1 -        temp = 0 -        l[i + 1] = temp -r = [0] * (n + 1) -temp = 0 +        cnt = 0 +else: +    l.append(cnt) +# print(l) +r = [] +cnt = 0 +    r.append(cnt) -        temp += 1 -        r[i] = temp +        cnt += 1 -        temp = 0 -        r[i] = temp -# print(l) +        cnt = 0 +else: +    r.append(cnt) +r.reverse() -ans = [0] * (n + 1) -for i in range(n + 1): -    ans[i] = max(l[i], r[i]) -# print(ans) -print((sum(ans))) +A = [0] * len(l) +for i in range(len(A)): +    A[i] = max(l[i], r[i]) +print((sum(A)))