#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=5e5+7;

ll ans;
char s[N];
int n,sl[N],sr[N];

int main()
{
    cin>>(s+1);
    n=strlen(s+1);
    for(int i=1;i<=n;i++){
        if(s[i]=='>') sl[i]=i;
        else sl[i]=sl[i-1];
    }
    sr[n]=n;
    for(int i=n-1;i>=0;i--){
        if(s[i+1]=='<') sr[i]=i;
        else sr[i]=sr[i+1];
    }
    for(int i=0;i<=n;i++)
        ans+=max(i-sl[i],sr[i]-i);
    cout<<ans<<endl;
    return 0;
}
