S = input().strip()

N = len(S)+1

A = [0 for _ in range(N)]

B = []

for i in range(N):

    if i==0 and S[i]=="<":

        B.append(0)

    elif i<N-2 and S[i]==">" and S[i+1]=="<":

        B.append(i+1)

    elif i==N-2 and S[i]==">":

        B.append(i+1)

for j in range(len(B)-1):

    ind0 = B[j]

    ind1 = B[j+1]

    c = ind0

    while S[c]=="<":

        A[c+1] = max(A[c+1],A[c]+1)

        c += 1

    c = ind1

    while S[c-1]==">":

        A[c-1] = max(A[c-1],A[c]+1)

        c -= 1

c = B[0]

if c>0:

    for i in range(c-1,-1,-1):

        A[i] = A[i+1]+1

c = B[-1]

if c<N-1:

    for i in range(c+1,N):

        A[i] = A[i-1]+1

print((sum(A)))
S = input().strip()

N = len(S)+1

A = [0 for _ in range(N)]

flag = -1

B = []

for i in range(N-1):

    if flag==-1 and S[i]=="<":

        B.append(i)

        flag = 1

    elif flag==1 and S[i]==">":

        flag = -1

if flag==-1:

    B.append(N-1)

for b in B:

    for i in range(b,N-1):

        if S[i]=="<":

            A[i+1] = max(A[i+1],A[i]+1)

        else:break

    for i in range(b-1,-1,-1):

        if S[i]==">":

            A[i] = max(A[i],A[i+1]+1)

        else:break

print((sum(A)))
S = input().strip()
N = len(S) + 1
A = [0 for _ in range(N)]
B = []
for i in range(N):
    if i == 0 and S[i] == "<":
        B.append(0)
    elif i < N - 2 and S[i] == ">" and S[i + 1] == "<":
        B.append(i + 1)
    elif i == N - 2 and S[i] == ">":
        B.append(i + 1)
for j in range(len(B) - 1):
    ind0 = B[j]
    ind1 = B[j + 1]
    c = ind0
    while S[c] == "<":
        A[c + 1] = max(A[c + 1], A[c] + 1)
        c += 1
    c = ind1
    while S[c - 1] == ">":
        A[c - 1] = max(A[c - 1], A[c] + 1)
        c -= 1
c = B[0]
if c > 0:
    for i in range(c - 1, -1, -1):
        A[i] = A[i + 1] + 1
c = B[-1]
if c < N - 1:
    for i in range(c + 1, N):
        A[i] = A[i - 1] + 1
print((sum(A)))

S = input().strip()
N = len(S) + 1
A = [0 for _ in range(N)]
flag = -1
B = []
for i in range(N - 1):
    if flag == -1 and S[i] == "<":
        B.append(i)
        flag = 1
    elif flag == 1 and S[i] == ">":
        flag = -1
if flag == -1:
    B.append(N - 1)
for b in B:
    for i in range(b, N - 1):
        if S[i] == "<":
            A[i + 1] = max(A[i + 1], A[i] + 1)
        else:
            break
    for i in range(b - 1, -1, -1):
        if S[i] == ">":
            A[i] = max(A[i], A[i + 1] + 1)
        else:
            break
print((sum(A)))

+flag = -1 -for i in range(N): -    if i == 0 and S[i] == "<": -        B.append(0) -    elif i < N - 2 and S[i] == ">" and S[i + 1] == "<": -        B.append(i + 1) -    elif i == N - 2 and S[i] == ">": -        B.append(i + 1) -for j in range(len(B) - 1): -    ind0 = B[j] -    ind1 = B[j + 1] -    c = ind0 -    while S[c] == "<": -        A[c + 1] = max(A[c + 1], A[c] + 1) -        c += 1 -    c = ind1 -    while S[c - 1] == ">": -        A[c - 1] = max(A[c - 1], A[c] + 1) -        c -= 1 -c = B[0] -if c > 0: -    for i in range(c - 1, -1, -1): -        A[i] = A[i + 1] + 1 -c = B[-1] -if c < N - 1: -    for i in range(c + 1, N): -        A[i] = A[i - 1] + 1 +for i in range(N - 1): +    if flag == -1 and S[i] == "<": +        B.append(i) +        flag = 1 +    elif flag == 1 and S[i] == ">": +        flag = -1 +if flag == -1: +    B.append(N - 1) +for b in B: +    for i in range(b, N - 1): +        if S[i] == "<": +            A[i + 1] = max(A[i + 1], A[i] + 1) +        else: +            break +    for i in range(b - 1, -1, -1): +        if S[i] == ">": +            A[i] = max(A[i], A[i + 1] + 1) +        else: +            break