Language: C++

#include "bits/stdc++.h"
using namespace std;
#define INF 1e9
#define rep(i, n) for(int i=0;i<n;i++)
#define ALL(x) (x).begin(), (x).end()  //昇順
#define RALL(x) (x).rbegin(), (x).rend() // 降順
const long long mod = 1e9+7;
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<bool> VB;
typedef vector<int> VI;  // VI a(n);
typedef vector<string> VS;  
typedef vector<char> VC; 
typedef vector<VS> VSS;
typedef vector<VC> VCC;    
typedef vector<VI> VII;   // VII a(n,vector<int>(m)) n * m 
typedef vector<VL> VLL;
typedef pair<int, int> PII;
typedef map<int, int> MP;   //MP a;
typedef vector<pair<int, int> > PS;
typedef long long ll;  //ll とdoubleは違う
template <class T>  // chmax(max, a);
bool chmax(T &a, T b){
    if (a < b){ a = b;return 1;}
    return 0;
}
template <class T> //chmin(min,a)
bool chmin(T &a, T b){
    if (b < a){ a = b; return 1;}
    return 0;
}
template<typename T>   // operator << (cout,a);
ostream& operator << (ostream& os, vector<T>& v) {
    os << "{";
    rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
    os << "}";
    return os;
}
   
// g++ -std=c++11 prac.cpp
ll Max=-1e9,Min=1e9+1;

int main(){
    int b,d,x,y=0,z,n,m,k,w,l_sum=0,r_sum=0,ans=0;
    string s,t;
    bool count=true,ok=true;
    cin.tie(0);
	ios::sync_with_stdio(0);
	cout<<fixed<<setprecision(20);
	
	string s;cin>>s;
	int n=s.size()+1;
	vi a(n);
	rep(i,n-1)
		if(s[i]=='<')
			chmax(a[i+1],a[i]+1);
	per(i,n-1)
		if(s[i]=='>')
			chmax(a[i],a[i+1]+1);
	cout<<accumulate(all(a),int(0))<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:51:16: error: redeclaration of 'std::string s'
   51 |         string s;cin>>s;
      |                ^
a.cc:45:12: note: 'std::string s' previously declared here
   45 |     string s,t;
      |            ^
a.cc:52:13: error: redeclaration of 'int n'
   52 |         int n=s.size()+1;
      |             ^
a.cc:44:21: note: 'int n' previously declared here
   44 |     int b,d,x,y=0,z,n,m,k,w,l_sum=0,r_sum=0,ans=0;
      |                     ^
a.cc:53:9: error: 'vi' was not declared in this scope; did you mean 'VI'?
   53 |         vi a(n);
      |         ^~
      |         VI
a.cc:56:31: error: 'a' was not declared in this scope
   56 |                         chmax(a[i+1],a[i]+1);
      |                               ^
a.cc:57:13: error: 'i' was not declared in this scope
   57 |         per(i,n-1)
      |             ^
a.cc:57:9: error: 'per' was not declared in this scope
   57 |         per(i,n-1)
      |         ^~~
a.cc:60:30: error: 'a' was not declared in this scope
   60 |         cout<<accumulate(all(a),int(0))<<endl;
      |                              ^
a.cc:60:26: error: 'all' was not declared in this scope; did you mean 'std::filesystem::perms::all'?
   60 |         cout<<accumulate(all(a),int(0))<<endl;
      |                          ^~~
      |                          std::filesystem::perms::all
In file included from /usr/include/c++/14/filesystem:51,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200,
                 from a.cc:1:
/usr/include/c++/14/bits/fs_fwd.h:158:7: note: 'std::filesystem::perms::all' declared here
  158 |       all               =  0777,
      |       ^~~