#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace __gnu_pbds;
using namespace std;
 
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
typedef long long ll;
typedef long double ld;
typedef pair <long long,long long> ii;
// typedef complex<long double> point;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin >> s;
    ll n = s.size()+1;
    vector <ll> arr(n);
    ll mini = 0;
    for (int z=1;z<n;z++){
        if (s[z-1] == '<'){
            arr[z] = arr[z-1]+1;
        } else {
            arr[z] = arr[z-1]-1;
        }
        mini = min(mini,arr[z]);
    }
    ll ans = 0;
    for (int z=0;z<n;z++){
        arr[z] -= mini;
    }
    for (int z=0;z<n-1;z++){
        if (s[z] == '<' && z == 0){
            arr[z] = 0;
        }
        else if (z == 0){
            arr[z] = arr[z+1]+1;
        }
        else {
            if (s[z] == '>' && s[z-1] == '<'){
                arr[z] = max(arr[z-1],arr[z+1])+1;
            }
            else if (s[z] == '>' && s[z-1] == '>'){
                arr[z] = arr[z+1]+1;
            }
            else if (s[z] == '<' && s[z-1] == '<'){
                arr[z] = arr[z-1]+1;
            }
            else {
               arr[z] = 0;
            }
        }
    }
    for (int z=n-1;z>0;z--){
        if (s[z-1] == '<' && z == n-1){
            arr[z] = arr[z-1]+1;
        }
        else if (z == n-1){
            arr[z] = 0;
        }
        else {
            if (s[z] == '>' && s[z-1] == '<'){
                arr[z] = max(arr[z-1],arr[z+1])+1;
            }
            else if (s[z] == '>' && s[z-1] == '>'){
                arr[z] = arr[z+1]+1;
            }
            else if (s[z] == '<' && s[z-1] == '<'){
                arr[z] = arr[z-1]+1;
            }
            else {
               arr[z] = 0;
            }
        }
    }
    for (int z=0;z<n-1;z++){
        if (s[z] == '<' && z == 0){
            arr[z] = 0;
        }
        else if (z == 0){
            arr[z] = arr[z+1]+1;
        }
        else {
            if (s[z] == '>' && s[z-1] == '<'){
                arr[z] = max(arr[z-1],arr[z+1])+1;
            }
            else if (s[z] == '>' && s[z-1] == '>'){
                arr[z] = arr[z+1]+1;
            }
            else if (s[z] == '<' && s[z-1] == '<'){
                arr[z] = arr[z-1]+1;
            }
            else {
               arr[z] = 0;
            }
        }
    }
    for (int z=n-1;z>0;z--){
        if (s[z-1] == '<' && z == n-1){
            arr[z] = arr[z-1]+1;
        }
        else if (z == n-1){
            arr[z] = 0;
        }
        else {
            if (s[z] == '>' && s[z-1] == '<'){
                arr[z] = max(arr[z-1],arr[z+1])+1;
            }
            else if (s[z] == '>' && s[z-1] == '>'){
                arr[z] = arr[z+1]+1;
            }
            else if (s[z] == '<' && s[z-1] == '<'){
                arr[z] = arr[z-1]+1;
            }
            else {
               arr[z] = 0;
            }
        }
    }
    for (int z=0;z<n;z++){
        // if (z != n-1) cout << arr[z] << " " << s[z] << " ";
        // else cout << arr[z] << endl;
        ans += arr[z];
    }
    cout << ans << endl;
}
 
 

Measured memory_bytes: 4764