#include <string>                                                                                                                                                                                                                                                                                
#include <fstream>                                                                                                                                                                                                                                                                               
#include <iostream>                                                                                                                                                                                                                                                                              
using namespace std;                                                                                                                                                                                                                                                                             
                                                                                                                                                                                                                                                                                                 
int main()                                                                                                                                                                                                                                                                                       
{                                                                                                                                                                                                                                                                                                
  string s;                                                                                                                                                                                                                                                                                      
  cin >> s;                                                                                                                                                                                                                                                                                      
                                                                                                                                                                                                                                                                                                 
  int str_len = s.length();                                                                                                                                                                                                                                                                      
  int buf = 0;                                                                                                                                                                                                                                                                                   
  long total = 0;                                                                                                                                                                                                                                                                                
                                                                                                                                                                                                                                                                                                 
  long l,r;                                                                                                                                                                                                                                                                                      
  while (buf < str_len)                                                                                                                                                                                                                                                                          
  {                                                                                                                                                                                                                                                                                              
    l = 0;                                                                                                                                                                                                                                                                                       
    r = 0;                                                                                                                                                                                                                                                                                       
                                                                                                                                                                                                                                                                                                 
    while (buf < str_len && s.compare(buf, 1, "<") == 0)                                                                                                                                                                                                                                         
    {                                                                                                                                                                                                                                                                                            
      l++;                                                                                                                                                                                                                                                                                       
      buf++;                                                                                                                                                                                                                                                                                     
    }                                                                                                                                                                                                                                                                                            
    while (buf < str_len && s.compare(buf, 1, ">") == 0)                                                                                                                                                                                                                                         
    {                                                                                                                                                                                                                                                                                            
      r++;                                                                                                                                                                                                                                                                                       
      buf++;                                                                                                                                                                                                                                                                                     
    }                                                                                                                                                                                                                                                                                            
                                                                                                                                                                                                                                                                                                 
    long n = max(l, r);                                                                                                                                                                                                                                                                          
    total += n * ( n + 1 ) / 2;                                                                                                                                                                                                                                                                  
    long m = min(l, r) - 1;                                                                                                                                                                                                                                                                      
    total += m * ( m + 1 ) / 2;                                                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                                                                                 
  }                                                                                                                                                                                                                                                                                              
  cout << total << "\n";                                                                                                                                                                                                                                                                         
                                                                                                                                                                                                                                                                                                 
}

Measured memory_bytes: 900