def main():

    S = eval(input())

    N = len(S)

    li = []

    pre = S[0]

    pre_cnt = 1

    l_cnt = 0

    for i in range(1, N):

        if (pre == '<' and S[i] == '>') or (pre == '>' and S[i] == '<'):

            li.append((pre*pre_cnt, l_cnt))

            pre = S[i]

            pre_cnt = 1

            l_cnt += 1

        else:

            pre_cnt += 1

    else:

        li.append((pre*pre_cnt, l_cnt))

    finished = [False] * (len(li)+1)

    li.sort(key=lambda s: len(s[0]), reverse=True)



    ans = 0

    for i in range(len(li)):

        if li[i][0][0] == '<':

            n = len(li[i][0])

            if finished[li[i][1] + 1]:

                n -= 1

            ans += (n*(n+1))//2

        else:

            n = len(li[i][0])

            if finished[li[i][1]]:

                n -= 1

            ans += (n*(n+1))//2

        finished[li[i][1]] = True

        finished[li[i][1] + 1] = True



    print(ans)





if __name__ == '__main__':

    main()

def main():

    S = eval(input())

    from itertools import groupby

    ans = 0

    SL = [(k, len(list(v))) for k, v in groupby(S)]

    if SL[0][0] == ">":

        ans += (SL[0][1])*(SL[0][1] + 1)//2

        pre_v = SL[0][1]

        for k, v in SL[1:]:

            if k == "<":

                pre_v = v

                continue

            else:

                if pre_v > v:

                    ans += pre_v*(pre_v+1)//2

                    ans += v*(v-1)//2

                else:

                    ans += (pre_v-1)*pre_v//2

                    ans += v*(v+1)//2

            # print(ans, pre, pre_v)

            pre_v = v

    else:

        pre_v = 0

        for k, v in SL:

            if k == "<":

                pre_v = v

                continue

            else:

                if pre_v > v:

                    ans += pre_v*(pre_v+1)//2

                    ans += v*(v-1)//2

                else:

                    ans += (pre_v-1)*pre_v//2

                    ans += v*(v+1)//2

            # print(ans, pre, pre_v)

            pre_v = v

    if SL[-1][0] == "<":

        ans += (SL[-1][1])*(SL[-1][1] + 1)//2

    print(ans)





if __name__ == '__main__':

    main()

def main():
    S = eval(input())
    N = len(S)
    li = []
    pre = S[0]
    pre_cnt = 1
    l_cnt = 0
    for i in range(1, N):
        if (pre == "<" and S[i] == ">") or (pre == ">" and S[i] == "<"):
            li.append((pre * pre_cnt, l_cnt))
            pre = S[i]
            pre_cnt = 1
            l_cnt += 1
        else:
            pre_cnt += 1
    else:
        li.append((pre * pre_cnt, l_cnt))
    finished = [False] * (len(li) + 1)
    li.sort(key=lambda s: len(s[0]), reverse=True)
    ans = 0
    for i in range(len(li)):
        if li[i][0][0] == "<":
            n = len(li[i][0])
            if finished[li[i][1] + 1]:
                n -= 1
            ans += (n * (n + 1)) // 2
        else:
            n = len(li[i][0])
            if finished[li[i][1]]:
                n -= 1
            ans += (n * (n + 1)) // 2
        finished[li[i][1]] = True
        finished[li[i][1] + 1] = True
    print(ans)


if __name__ == "__main__":
    main()

def main():
    S = eval(input())
    from itertools import groupby

    ans = 0
    SL = [(k, len(list(v))) for k, v in groupby(S)]
    if SL[0][0] == ">":
        ans += (SL[0][1]) * (SL[0][1] + 1) // 2
        pre_v = SL[0][1]
        for k, v in SL[1:]:
            if k == "<":
                pre_v = v
                continue
            else:
                if pre_v > v:
                    ans += pre_v * (pre_v + 1) // 2
                    ans += v * (v - 1) // 2
                else:
                    ans += (pre_v - 1) * pre_v // 2
                    ans += v * (v + 1) // 2
            # print(ans, pre, pre_v)
            pre_v = v
    else:
        pre_v = 0
        for k, v in SL:
            if k == "<":
                pre_v = v
                continue
            else:
                if pre_v > v:
                    ans += pre_v * (pre_v + 1) // 2
                    ans += v * (v - 1) // 2
                else:
                    ans += (pre_v - 1) * pre_v // 2
                    ans += v * (v + 1) // 2
            # print(ans, pre, pre_v)
            pre_v = v
    if SL[-1][0] == "<":
        ans += (SL[-1][1]) * (SL[-1][1] + 1) // 2
    print(ans)


if __name__ == "__main__":
    main()

-    N = len(S) -    li = [] -    pre = S[0] -    pre_cnt = 1 -    l_cnt = 0 -    for i in range(1, N): -        if (pre == "<" and S[i] == ">") or (pre == ">" and S[i] == "<"): -            li.append((pre * pre_cnt, l_cnt)) -            pre = S[i] -            pre_cnt = 1 -            l_cnt += 1 -        else: -            pre_cnt += 1 +    from itertools import groupby + +    ans = 0 +    SL = [(k, len(list(v))) for k, v in groupby(S)] +    if SL[0][0] == ">": +        ans += (SL[0][1]) * (SL[0][1] + 1) // 2 +        pre_v = SL[0][1] +        for k, v in SL[1:]: +            if k == "<": +                pre_v = v +                continue +            else: +                if pre_v > v: +                    ans += pre_v * (pre_v + 1) // 2 +                    ans += v * (v - 1) // 2 +                else: +                    ans += (pre_v - 1) * pre_v // 2 +                    ans += v * (v + 1) // 2 +            # print(ans, pre, pre_v) +            pre_v = v -        li.append((pre * pre_cnt, l_cnt)) -    finished = [False] * (len(li) + 1) -    li.sort(key=lambda s: len(s[0]), reverse=True) -    ans = 0 -    for i in range(len(li)): -        if li[i][0][0] == "<": -            n = len(li[i][0]) -            if finished[li[i][1] + 1]: -                n -= 1 -            ans += (n * (n + 1)) // 2 -        else: -            n = len(li[i][0]) -            if finished[li[i][1]]: -                n -= 1 -            ans += (n * (n + 1)) // 2 -        finished[li[i][1]] = True -        finished[li[i][1] + 1] = True +        pre_v = 0 +        for k, v in SL: +            if k == "<": +                pre_v = v +                continue +            else: +                if pre_v > v: +                    ans += pre_v * (pre_v + 1) // 2 +                    ans += v * (v - 1) // 2 +                else: +                    ans += (pre_v - 1) * pre_v // 2 +                    ans += v * (v + 1) // 2 +            # print(ans, pre, pre_v) +            pre_v = v +    if SL[-1][0] == "<": +        ans += (SL[-1][1]) * (SL[-1][1] + 1) // 2