s=io.read()
total=0
if s:sub(1,1)==">" then
    n=(#s:match(">"))
    total=total+n*(n+1)//2
end
if s:sub(#s,#s)=="<" then
    n=(#string.reverse(s):match("<+"))
    total=total+n*(n+1)//2
end
for i,_ in string.gmatch(s,"<+>+") do
    for j,_ in string.gmatch(i,">+") do
        x=math.max(#i-#j,#j)
        y=math.min(#i-#j,#j)
        total=total+x*(x+1)//2+y*(y-1)//2
    end
end
print(total)