

def main():

  from itertools import groupby



  s = list(eval(input()))

  f = 0

  ans = 0



  for k,v in groupby(s):

    d = len(tuple(v))

    left = d if k==">" else 0

    right = d if k=="<" else 0

    if f>left:

      ans += d*(d+1)//2 - left

    else:

      ans += -1*f + d*(d+1)//2  

    f = right 



  print(ans) 



if __name__ == '__main__':

    main()
def main():

  s = tuple(eval(input()))

  

  f = "" # 前回のステップの文字 "<" or ">" 

  ans = 0 # Answer

  count = 0 # Ai

  continuous = 0 # ">" が何回連続するか

  

  for m in s:

    if m=="<":

      if f==">" and count>0:

        # 清算

        ans-=count*continuous

        count=0

      count+=1

        

    else:

      if f=="<":

        # セット

        continuous=0

      count-=1

      continuous+=1



    if count>=0:

      ans+=count

    else:

      ans+=continuous

      count=0

    

    f=m



  print(ans)

    

if __name__ == '__main__':

    main()
def main():
    from itertools import groupby

    s = list(eval(input()))
    f = 0
    ans = 0
    for k, v in groupby(s):
        d = len(tuple(v))
        left = d if k == ">" else 0
        right = d if k == "<" else 0
        if f > left:
            ans += d * (d + 1) // 2 - left
        else:
            ans += -1 * f + d * (d + 1) // 2
        f = right
    print(ans)


if __name__ == "__main__":
    main()

def main():
    s = tuple(eval(input()))
    f = ""  # 前回のステップの文字 "<" or ">"
    ans = 0  # Answer
    count = 0  # Ai
    continuous = 0  # ">" が何回連続するか
    for m in s:
        if m == "<":
            if f == ">" and count > 0:
                # 清算
                ans -= count * continuous
                count = 0
            count += 1
        else:
            if f == "<":
                # セット
                continuous = 0
            count -= 1
            continuous += 1
        if count >= 0:
            ans += count
        else:
            ans += continuous
            count = 0
        f = m
    print(ans)


if __name__ == "__main__":
    main()

-    from itertools import groupby - -    s = list(eval(input())) -    f = 0 -    ans = 0 -    for k, v in groupby(s): -        d = len(tuple(v)) -        left = d if k == ">" else 0 -        right = d if k == "<" else 0 -        if f > left: -            ans += d * (d + 1) // 2 - left +    s = tuple(eval(input())) +    f = ""  # 前回のステップの文字 "<" or ">" +    ans = 0  # Answer +    count = 0  # Ai +    continuous = 0  # ">" が何回連続するか +    for m in s: +        if m == "<": +            if f == ">" and count > 0: +                # 清算 +                ans -= count * continuous +                count = 0 +            count += 1 -            ans += -1 * f + d * (d + 1) // 2 -        f = right +            if f == "<": +                # セット +                continuous = 0 +            count -= 1 +            continuous += 1 +        if count >= 0: +            ans += count +        else: +            ans += continuous +            count = 0 +        f = m