// #include <bits/stdc++.h>
// #define WHOLE(v) (v).begin(), (v).end()
// #define REV_WHOLE(v) (v).rbegin(), (v).rend()
// using i64 = int64_t;
// using namespace std;
// template <size_t I, class H, class... T> struct TupleReaderWriter{static tuple<H,T...> r(istream&i){H v;i>>v;return tuple_cat(tuple<H>(v),TupleReaderWriter<sizeof...(T)-1,T...>::r(i));}static void w(ostream&o,tuple<H,T...>&t,string d){TupleReaderWriter<I-1,H,T...>::w(o,t,d);o<<d<<get<I>(t);}};
// template <class H, class... T> struct TupleReaderWriter<0,H,T...>{static tuple<H,T...> r(istream&i){H v;i>>v;return tuple<H>(v);}static void w(ostream&o,tuple<H,T...>&t,string d){o<<get<0>(t);}};
// template<class T>istream&operator>>(istream&i,vector<T>&v){for(auto&x:v)i>>x;return i;}
// template<class T>ostream&operator<<(ostream&o,vector<T>&v){string delim="";for(auto&x:v)o<<delim<<x,delim=" ";return o;}
// template <class... T> istream& operator>>(istream&i,tuple<T...>& t) { t = TupleReaderWriter<sizeof...(T), T...>::r(i); return i; }
// template <class... T> ostream& operator<<(ostream& o, tuple<T...>& t) { string delim = " "; TupleReaderWriter<sizeof...(T) - 1, T...>::w(o, t, delim); return o; }
// template<typename T> using rev_priority_queue = priority_queue<T, vector<T>, greater<T>>;
// template<typename T> using vector2d = vector<vector<T>>;
// void R_YESNO(bool p) { cout << (p ? "YES" : "NO") << endl; }
// void R_YesNo(bool p) { cout << (p ? "Yes" : "No") << endl; }
// int main() {
//     i64 N;
//     string S;
//     cin >> S;
//     N = S.size() + 1;
//     vector<i64> A(N, 0);
//     // 極大点
//     set<i64> s;
//     // 極小点
//     queue<i64> q;
//     for (i64 i = 0; i < N; i++) {
//         if(i == 0) {
//             if (S[i] == '<') q.push(i);
//             else s.insert(i);
//         } else if(i == N - 1) {
//             if(S[i - 1] == '>') q.push(i);
//             else s.insert(i);
//         } else if (S[i - 1] == '>' && S[i] == '<') {
//             q.push(i);
//         } else if(S[i - 1] == '<' && S[i] == '>') {
//             s.insert(i);
//         }
//     }
//     while(q.size()) {
//         i64 a = q.front(); q.pop();
//         if (!s.count(a + 1) && a + 1 < N && S[a] == '<') {
//                 q.push(a + 1);
//                 A[a + 1] = A[a] + 1;
//         }
//         if (!s.count(a - 1) && a - 1 >= 0 && S[a - 1] == '>') {
//                 q.push(a - 1);
//                 A[a - 1] = A[a] + 1;
//         }
//     }
//     for(i64 x : s) {
//         if(x == 0) A[x] = A[x + 1] + 1;
//         else if(x == N - 1) A[x] = A[x - 1] + 1;
//         else A[x] = max(A[x + 1], A[x - 1]) + 1;
//     }
//     i64 ans = accumulate(WHOLE(A), 0);
//     cout << ans << endl;
//     return 0;
// }

#include <bits/stdc++.h>
#define WHOLE(v) (v).begin(), (v).end()
#define REV_WHOLE(v) (v).rbegin(), (v).rend()
using i64 = int64_t;
using namespace std;
template <size_t I, class H, class... T> struct TupleReaderWriter{static tuple<H,T...> r(istream&i){H v;i>>v;return tuple_cat(tuple<H>(v),TupleReaderWriter<sizeof...(T)-1,T...>::r(i));}static void w(ostream&o,tuple<H,T...>&t,string d){TupleReaderWriter<I-1,H,T...>::w(o,t,d);o<<d<<get<I>(t);}};
template <class H, class... T> struct TupleReaderWriter<0,H,T...>{static tuple<H,T...> r(istream&i){H v;i>>v;return tuple<H>(v);}static void w(ostream&o,tuple<H,T...>&t,string d){o<<get<0>(t);}};
template<class T>istream&operator>>(istream&i,vector<T>&v){for(auto&x:v)i>>x;return i;}
template<class T>ostream&operator<<(ostream&o,vector<T>&v){string delim="";for(auto&x:v)o<<delim<<x,delim=" ";return o;}
template <class... T> istream& operator>>(istream&i,tuple<T...>& t) { t = TupleReaderWriter<sizeof...(T), T...>::r(i); return i; }
template <class... T> ostream& operator<<(ostream& o, tuple<T...>& t) { string delim = " "; TupleReaderWriter<sizeof...(T) - 1, T...>::w(o, t, delim); return o; }
template<typename T> using rev_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<typename T> using vector2d = vector<vector<T>>;
void R_YESNO(bool p) { cout << (p ? "YES" : "NO") << endl; }
void R_YesNo(bool p) { cout << (p ? "Yes" : "No") << endl; }
int main() {
    int N;
    string S;
    cin >> S;
    N = S.size() + 1;

    const i64 INF = 1e14;

    vector<i64> a(N, 0);

    for(int i = 1; i <= N; i++) {
        if(S[i - 1] == '<') {
            a[i] = max(a[i], a[i - 1] + 1);
        }
    }
    for(int i = N - 2; i >= 0; i--) {
        if(S[i] == '>') {
            a[i] = max(a[i], a[i + 1] + 1);
        }
    }

    i64 ans = 0;
    for(int i = 0; i < N; i++) {
        ans += a[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4740