//code by lynmisakura.wish to be accepted!
/****************************/
#include <cstdlib>
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<algorithm>
#include<bitset>
#include <climits>
#include<set>
#include<bitset>
using namespace std;
/***************************/
typedef long long ll;
typedef vector<ll> vi;
typedef vector<long long> vl;
typedef pair<ll, ll> pi;
typedef vector<pair<ll, ll>> vpi;

//const long long INF = 1LL << 55;

#define itn ll
#define endl '\n'
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ss second
#define ff first
#define dup(x,y) ((x) + (y) - 1)/(y)
#define mins(x,y) x = min(x,y)
#define maxs(x,y) x = max(x,y)
#define all(x) (x).begin(),(x).end()
#define Rep(n) for(ll i = 0;i < n;i++)
#define rep(i,n) for(ll i = 0;i < n;i++)
#define flush fflush(stdout)
#define rrep(i,n) for(ll i = n - 1;i >= 0;i--)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define ioboost cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20)
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll qp(ll a, ll b) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a; a = 1ll * a*a; } while (b >>= 1); return ans; }
ll qp(ll a, ll b, ll mo) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a%mo; a = 1ll * a*a%mo; } while (b >>= 1); return ans; }

#define _GLIBCXX_DEBUG
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
inline string ins(){
   string s;cin >> s;return s;
}
inline int in(){
   int x;scanf("%d",&x);return x;
}
inline long long inl(){
   long long x;scanf("%lld",&x);return x;
}
inline vector<int> vin(int N = 0,int sorted = 0){
   if(!N)scanf("%d",&N);
   vector<int> a(N);
   for(int i = 0;i < N;i++){
      scanf("%d",&a[i]);
   }
   if(sorted)sort(a.begin(),a.end());
   return a;
}
inline vector<long long> vinl(int N = 0,int sorted = 0){
   if(!N)scanf("%d",&N);
   vector<long long> a(N);
   for(int i = 0;i < N;i++){
      scanf("%lld",&a[i]);
   }
   if(sorted)sort(a.begin(),a.end());
   return a;
}
inline vector<vector<int>> ingraph(int tree = 0){
   int N,M;
   if(!tree)scanf("%d%d",&N,&M);
   else{scanf("%d",&N); M = N - 1;}
   cout << N << " " << M << endl;
   vector<vector<int>> G(N,vector<int>(0));
   cout << "vector set" << endl;
   for(int i = 0;i < M;i++){
      int a,b;scanf("%d%d",&a,&b);
      G[--a].push_back(--b);
      G[b].push_back(a);//無向グラフ
      cout << "ok" << endl;
   }
   return G;
}
template<typename T> void debug_v(vector<T> arr,string name_of_vector = "hoge"){
   int n = arr.size();
   string name = name_of_vector;
   cout << name << " = ";
   for(int i = 0;i < n;i++){
      if(!i)cout << "[" << arr[i];
      else{
         cout << ", " << arr[i];
      }
   }
   cout << "]" << endl;
}
//文字列のランレングス圧縮
vector<pair<char,ll>> runlength(string s){
	ll i = 0;
	ll n = s.size();
	vector<pair<char, ll>> run;
	while (i < n) {
		char t = s[i];
		int k = 0;
		while (i + k < n && s[i + k] == t) k++;
		run.push_back(pair<char, ll>(t, k));
		i += k;
	}
	return run;
}
int main(void){
    string s = ins();
    ll m = s.size();
    auto run = runlength(s);
    //for(auto i : run)cout << i.ss << " ";cout << endl;
    vector<ll> a(m + 1,0);
    ll ans = 0;

    int sz = run.size();
    if(sz == 1){
        cout << m*(m+1)/2 << endl;
        return 0;
    }

    if(s[0] == '<'){
        for(int i = 0;i <  sz;i+=2){
            if(i == sz - 1)break;
            if(run[i].ss >= run[i+1].ss){
                ans += (run[i].ss)*(run[i].ss+1)/2;
                ans += (run[i+1].ss)*(run[i+1].ss - 1)/2;
            }else{
                ans += (run[i].ss-1)*(run[i].ss)/2;
                ans += (run[i+1].ss+1)*(run[i+1].ss)/2;
            }

        }
       // cout << ans << endl;
       // cout << m << endl;
        if(sz %2 != 0){
            ans += (run.back().ss+1)*(run.back().ss)/2;
        }
    }else{
        ans += run[0].ss*(run[0].ss + 1)/2;
        //cout << ans << endl;
        for(int i = 1;i < sz;i+=2){
            if(i == sz - 1)break;
            if(run[i].ss >= run[i+1].ss){
                ans += (run[i].ss)*(run[i].ss+1)/2;
                ans += (run[i+1].ss)*(run[i+1].ss - 1)/2;
            }else{
                ans += (run[i].ss-1)*(run[i].ss-0)/2;
                ans += (run[i+1].ss+1)*(run[i+1].ss)/2;
            }
        }
        //cout << ans << endl;
        if(sz %2 == 0){
            ans += (run.back().ss+1)*(run.back().ss)/2;
        }
    }
    //cout << sz << endl;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 8840