#!/usr/bin/env python3



S = eval(input())

s_list = list(S)

w_list = [0]

min_n = 0

s_l = len(s_list)

totsu_list = [False]



if s_list[0] == "<":

    ou_list = [True]

else:

    ou_list = [False]



t_list = []

if ou_list[0]:

    t_list = ["ou"]

else:

    t_list = ["totsu"]



for i, char in enumerate(s_list):

    # 凹であるかどうか

    is_ou = False

    is_totsu = False

    if i == s_l - 1:

        if char == ">":

            is_ou = True

    else:

        if s_list[i] == "<" and s_list[i + 1] == ">":

            is_totsu = True

        elif s_list[i] == ">" and s_list[i + 1] == "<":

            is_ou = True



    ou_list.append(is_ou)

    totsu_list.append(is_totsu)

    if is_ou:

        t = "ou"

    elif is_totsu:

        t = "totsu"

    elif char == "<":

        t = "up"

    else:

        t = "down"

    t_list.append(t)



    if char == "<":

        w_list.append(w_list[i] + 1)

    else:

        w_list.append(w_list[i] - 1)

        min_n = min(w_list[i] - 1, min_n)



x_list = []

d = abs(min_n)

w_len = len(w_list)

for i, w in enumerate(w_list):

    t = t_list[i]

    if t == "ou":

        x = 0

    elif t == "up" or i == w_len - 1:

        x = x_list[i - 1] + 1

    else:

        x = w_list[i] + d

    x_list.append(x)



x_len = len(x_list)

y_list = x_list[:]



total = 0



for i in range(x_len):

    idx = x_len - (i + 1)

    t = t_list[idx]

    if t == "down":

        y_list[idx] = y_list[idx + 1] + 1

    elif t == "ou" or t == "down":

        pass

    elif t == "totsu":

        if idx == 0 or idx == x_len:

            pass

        else:

            a = y_list[idx - 1]

            b = y_list[idx + 1]

            y_list[idx] = max(a, b) + 1

    total += y_list[idx]



if len(y_list) >= 3:

    if t_list[0] == "totsu":

        total -= y_list[0]

        total += y_list[1] + 1

    if t_list[-1] == "totsu":

        total -= y_list[-1]

        total += y_list[-2] + 1



# ans = sum(z_list)

ans = total

print(ans)

#!/usr/bin/env python3



S = eval(input())

s_list = list(S)

s_l = len(s_list)

N = s_l + 1

t_list = ["ou"] if s_list[0] == "<" else ["totsu"]



# 1回目のループ: 凹凸↗︎↘︎を判定する

for i, char in enumerate(s_list):

    # 凹であるかどうか

    is_ou = False

    is_totsu = False

    if i == s_l - 1:

        if char == ">":

            is_ou = True

        else:

            is_totsu = True

    else:

        if s_list[i] == "<" and s_list[i + 1] == ">":

            is_totsu = True

        elif s_list[i] == ">" and s_list[i + 1] == "<":

            is_ou = True



    if is_ou:

        t = "ou"

    elif is_totsu:

        t = "totsu"

    elif char == "<":

        t = "up"

    else:

        t = "down"

    t_list.append(t)



# 2回目のループ: 凹と↗︎部分の値を確定させる

x_list = []

for i, t in enumerate(t_list):

    if t == "ou":

        x = 0

    elif t == "up" or i == N - 1:

        x = x_list[i - 1] + 1

    else:

        x = None

    x_list.append(x)



# 3回目のループ: 末尾から見ていって、凸と↘︎部分を確定させる

total = 0



for i in range(N):

    idx = N - (i + 1)

    t = t_list[idx]

    if t == "down":

        x_list[idx] = x_list[idx + 1] + 1

    elif t == "ou" or t == "down":

        pass

    elif t == "totsu":

        if idx == 0:

            x_list[0] = x_list[1] + 1

        elif idx == N - 1:

            x_list[idx] = x_list[idx - 1] + 1

        else:

            a = x_list[idx - 1]

            b = x_list[idx + 1]

            x_list[idx] = max(a, b) + 1

    total += x_list[idx]



ans = total

print(ans)

#!/usr/bin/env python3
S = eval(input())
s_list = list(S)
w_list = [0]
min_n = 0
s_l = len(s_list)
totsu_list = [False]
if s_list[0] == "<":
    ou_list = [True]
else:
    ou_list = [False]
t_list = []
if ou_list[0]:
    t_list = ["ou"]
else:
    t_list = ["totsu"]
for i, char in enumerate(s_list):
    # 凹であるかどうか
    is_ou = False
    is_totsu = False
    if i == s_l - 1:
        if char == ">":
            is_ou = True
    else:
        if s_list[i] == "<" and s_list[i + 1] == ">":
            is_totsu = True
        elif s_list[i] == ">" and s_list[i + 1] == "<":
            is_ou = True
    ou_list.append(is_ou)
    totsu_list.append(is_totsu)
    if is_ou:
        t = "ou"
    elif is_totsu:
        t = "totsu"
    elif char == "<":
        t = "up"
    else:
        t = "down"
    t_list.append(t)
    if char == "<":
        w_list.append(w_list[i] + 1)
    else:
        w_list.append(w_list[i] - 1)
        min_n = min(w_list[i] - 1, min_n)
x_list = []
d = abs(min_n)
w_len = len(w_list)
for i, w in enumerate(w_list):
    t = t_list[i]
    if t == "ou":
        x = 0
    elif t == "up" or i == w_len - 1:
        x = x_list[i - 1] + 1
    else:
        x = w_list[i] + d
    x_list.append(x)
x_len = len(x_list)
y_list = x_list[:]
total = 0
for i in range(x_len):
    idx = x_len - (i + 1)
    t = t_list[idx]
    if t == "down":
        y_list[idx] = y_list[idx + 1] + 1
    elif t == "ou" or t == "down":
        pass
    elif t == "totsu":
        if idx == 0 or idx == x_len:
            pass
        else:
            a = y_list[idx - 1]
            b = y_list[idx + 1]
            y_list[idx] = max(a, b) + 1
    total += y_list[idx]
if len(y_list) >= 3:
    if t_list[0] == "totsu":
        total -= y_list[0]
        total += y_list[1] + 1
    if t_list[-1] == "totsu":
        total -= y_list[-1]
        total += y_list[-2] + 1
# ans = sum(z_list)
ans = total
print(ans)

#!/usr/bin/env python3
S = eval(input())
s_list = list(S)
s_l = len(s_list)
N = s_l + 1
t_list = ["ou"] if s_list[0] == "<" else ["totsu"]
# 1回目のループ: 凹凸↗︎↘︎を判定する
for i, char in enumerate(s_list):
    # 凹であるかどうか
    is_ou = False
    is_totsu = False
    if i == s_l - 1:
        if char == ">":
            is_ou = True
        else:
            is_totsu = True
    else:
        if s_list[i] == "<" and s_list[i + 1] == ">":
            is_totsu = True
        elif s_list[i] == ">" and s_list[i + 1] == "<":
            is_ou = True
    if is_ou:
        t = "ou"
    elif is_totsu:
        t = "totsu"
    elif char == "<":
        t = "up"
    else:
        t = "down"
    t_list.append(t)
# 2回目のループ: 凹と↗︎部分の値を確定させる
x_list = []
for i, t in enumerate(t_list):
    if t == "ou":
        x = 0
    elif t == "up" or i == N - 1:
        x = x_list[i - 1] + 1
    else:
        x = None
    x_list.append(x)
# 3回目のループ: 末尾から見ていって、凸と↘︎部分を確定させる
total = 0
for i in range(N):
    idx = N - (i + 1)
    t = t_list[idx]
    if t == "down":
        x_list[idx] = x_list[idx + 1] + 1
    elif t == "ou" or t == "down":
        pass
    elif t == "totsu":
        if idx == 0:
            x_list[0] = x_list[1] + 1
        elif idx == N - 1:
            x_list[idx] = x_list[idx - 1] + 1
        else:
            a = x_list[idx - 1]
            b = x_list[idx + 1]
            x_list[idx] = max(a, b) + 1
    total += x_list[idx]
ans = total
print(ans)

-w_list = [0] -min_n = 0 -totsu_list = [False] -if s_list[0] == "<": -    ou_list = [True] -else: -    ou_list = [False] -t_list = [] -if ou_list[0]: -    t_list = ["ou"] -else: -    t_list = ["totsu"] +N = s_l + 1 +t_list = ["ou"] if s_list[0] == "<" else ["totsu"] +# 1回目のループ: 凹凸↗︎↘︎を判定する +        else: +            is_totsu = True -    ou_list.append(is_ou) -    totsu_list.append(is_totsu) -    if char == "<": -        w_list.append(w_list[i] + 1) -    else: -        w_list.append(w_list[i] - 1) -        min_n = min(w_list[i] - 1, min_n) +# 2回目のループ: 凹と↗︎部分の値を確定させる -d = abs(min_n) -w_len = len(w_list) -for i, w in enumerate(w_list): -    t = t_list[i] +for i, t in enumerate(t_list): -    elif t == "up" or i == w_len - 1: +    elif t == "up" or i == N - 1: -        x = w_list[i] + d +        x = None -x_len = len(x_list) -y_list = x_list[:] +# 3回目のループ: 末尾から見ていって、凸と↘︎部分を確定させる -for i in range(x_len): -    idx = x_len - (i + 1) +for i in range(N): +    idx = N - (i + 1) -        y_list[idx] = y_list[idx + 1] + 1 +        x_list[idx] = x_list[idx + 1] + 1 -        if idx == 0 or idx == x_len: -            pass +        if idx == 0: +            x_list[0] = x_list[1] + 1 +        elif idx == N - 1: +            x_list[idx] = x_list[idx - 1] + 1 -            a = y_list[idx - 1] -            b = y_list[idx + 1] -            y_list[idx] = max(a, b) + 1 -    total += y_list[idx] -if len(y_list) >= 3: -    if t_list[0] == "totsu": -        total -= y_list[0] -        total += y_list[1] + 1 -    if t_list[-1] == "totsu": -        total -= y_list[-1] -        total += y_list[-2] + 1 -# ans = sum(z_list) +            a = x_list[idx - 1] +            b = x_list[idx + 1] +            x_list[idx] = max(a, b) + 1 +    total += x_list[idx]