s=io.read()
total=0

left=0
if s:sub(1,1)==">" then
    left=#s:match(">")
    total=total+left*(left+1)//2
    if #s==left then
        print(total)
        return
    end
end

right=0
if s:sub(#s,#s)=="<" then
    right=#string.reverse(s):match("<+")
    total=total+right*(right+1)//2
    if #s==right then
        print(total)
        return
    end
end

if left+right==#s then
    print(total)
    return
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)