#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <algorithm>
#include <numeric>
#include <fstream>
#include <iomanip>
#include <stack>

typedef long double ld;
typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;


namespace util {

// 文字列のSplit
std::vector< std::string > split(std::string s, char delimiter)
{
  std::vector< std::string > vs;
  std::string sub;
  for (auto c : s) {
    if (c == delimiter) vs.push_back(sub), sub.clear();
    else sub += c;
  }
  vs.push_back(sub);
  return vs;
}

// 文字列の置換
void replaceString(std::string& str, std::string& from, std::string& to, std::string& replaced)
{
  ll from_length = (ll)from.length();

  for (auto it = str.begin(); it != str.end(); it++) {
    std::string sub = str.substr(std::distance(str.begin(), it), from_length);
    if (sub == from) {
      replaced += to;
      it += from_length - 1;
    } else {
      replaced += *it;
    }
  }
}

// 累乗
template < class S, class T >
S pow(S x, T n)
{
  ll ret = 1LL;
  while (n > 0) ret *= x, n--;
  return ret;
}

// 桁和
ll digitSum(ll x)
{
  std::string s = std::to_string(x); ll ret = 0LL;
  for (auto c : s) {ret += c - '0';}
  return ret;
}

} // namespace util

// Minimum, Maximum
template<class T> T minimum(T head, T tail) { return std::min(head, tail); }
template<class H, class... T> H minimum(H head, T... tail) { return std::min(head, minimum(tail...)); }
template<class T> T maximum(T head, T tail) { return std::max(head, tail); }
template<class H, class... T> H maximum(H head, T... tail) { return std::max(head, maximum(tail...)); }

// Output
template<class T, class S> std::ostream& operator <<(std::ostream& os, std::pair<T, S> p)
{
  return os << "(" << p.first << " " << p.second << ")";
}

template<class T> std::ostream& operator <<(std::ostream& os, std::vector< T > v)
{
  for (ll i = 0; i < (ll)v.size(); i++){ os << " [" << i << "]" << v[i]; if (i % 10 == 9) os << std::endl; }
  //os << v[0]; for (ll i = 1; i < (ll)v.size(); i++){ os << " " << v[i]; }
  return os;
}

template<class T, class S> std::ostream& operator <<(std::ostream& os, std::map< T, S > m)
{
  ll i = 0; for (auto p : m){ os << " [" << i << "]" << p.first << "->" << p.second; i++;}
  return os;
}

template<class T> std::ostream& operator <<(std::ostream& os, std::vector< std::vector<T> > vv)
{
  for (auto& vec : vv){ os << vec << std::endl; }
  os << "--------" << std::endl;
  return os;
}

void print(){ std::cout << std::endl; }
template<typename H> void print(H&& head){ std::cout << head << std::endl; }
template<typename H, typename... T> void print(H&& head, T&&... tail){
  std::cout << head << " ", print(std::forward<T>(tail)...);
}

void solve()
{
  std::string S;
  std::cin >> S;

  ll N = S.length() + 1;
  std::vector<ll> va(N, 0LL);

  std::stack<ll> stk;

  bool is_lower;
  if (S[0] == '>') {
    stk.push(0LL);
    is_lower = true;
  } else {
    va[0] = 0LL;
    is_lower = false;
  }

  ll ofs;
  for (ll i = 0; i < N-1; i++) {
    if (S[i] == '>') {
      stk.push(0LL);
      // < >
      if (!is_lower) stk.push(0LL);
      is_lower = true;
    } else {
      if (is_lower) {
        va[i+1] = 1LL;
        ofs = 0LL;
        while (!stk.empty()) {
          va[i-ofs] = std::max(va[i-ofs], ofs);
          stk.pop();
          ofs++;
        }
      } else {
        // < <
        va[i+1] = va[i] + 1;
      }
      is_lower = false;
    }
  }

  // 片付け
  ofs = 0LL;
  while (!stk.empty()) {
    va[N-1-ofs] = ofs;
    stk.pop();
    ofs++;
  }

  ll ans = std::accumulate(va.begin(), va.end(), 0LL);
  print(ans);
  return;
}

int main()
{
  std::cin.tie(nullptr);
  std::cout.tie(nullptr);
  std::ios::sync_with_stdio(false);

  solve();
  return 0;
}



Measured memory_bytes: 8732