Language: C++

#include <iostream>
#include <string>

int main(){
  std::string str;
  int *right, left, ans;
  int i;
  int sum = 0;
  
  std::cin >> str;
  
  int n = str.length();
  int right = new int[n+1];
  int left = new int[n+1]
  int ans = new int[n+1];
  
  for(i=0; i<n+1; i++){
    right[i] = -1;
    left[i] = -1;
    ans[i] = -1;
  }
  
  if(str[0] == '<'){
  	right[0] = 0;
    left[0] = 0;
    ans[0] =　0;
  }
  if(str[n-1] == '>'){
  	right[n] = 0;
  	left[n] = 0;
    ans[n] = 0;
  }
  
  for(i=0; i<n-1; i++){
    if(str[i] == '>' && str[i+1] == '<'){
      right[i+1] = 0;
      left[i+1] = 0;
      ans[i+1] = 0;
    }
  }
  
  for(i=0; i<n; i++){
  	if(str[i] == '<'){
      right[i+1] = right[i] + 1;
    }else{
      std::cout << "error..." << std::endl;
      break;
    }
  }
  
  for(i=n-1; i>=0; i--){
  	if(str[i] == '>'){
      right[i] = right[i+1] + 1;
    }else{
      std::cout << "error..." << std::endl;
      break;
    }
  }
  
  for(i=0;i<n+1;i++){
    if(ans[i] == -1){
      ans[i] = right[i] > left[i] ? right[i] : left[i];
    }
    sum += ans[i];
  }
  
  std::cout << sum << std::endl;
  
  delete[] right;
  delete[] left;
  delete []ans;
  
  return 0;
}

Compiler output:
a.cc:26:13: error: extended character 　 is not valid in an identifier
   26 |     ans[0] =　0;
      |             ^
a.cc: In function 'int main()':
a.cc:13:7: error: conflicting declaration 'int right'
   13 |   int right = new int[n+1];
      |       ^~~~~
a.cc:6:8: note: previous declaration as 'int* right'
    6 |   int *right, left, ans;
      |        ^~~~~
a.cc:14:7: error: redeclaration of 'int left'
   14 |   int left = new int[n+1]
      |       ^~~~
a.cc:6:15: note: 'int left' previously declared here
    6 |   int *right, left, ans;
      |               ^~~~
a.cc:19:9: error: invalid types 'int[int]' for array subscript
   19 |     left[i] = -1;
      |         ^
a.cc:20:8: error: invalid types 'int[int]' for array subscript
   20 |     ans[i] = -1;
      |        ^
a.cc:25:9: error: invalid types 'int[int]' for array subscript
   25 |     left[0] = 0;
      |         ^
a.cc:26:8: error: invalid types 'int[int]' for array subscript
   26 |     ans[0] =　0;
      |        ^
a.cc:26:13: error: '\U000030000' was not declared in this scope
   26 |     ans[0] =　0;
      |             ^~~
a.cc:30:13: error: invalid types 'int[int]' for array subscript
   30 |         left[n] = 0;
      |             ^
a.cc:31:8: error: invalid types 'int[int]' for array subscript
   31 |     ans[n] = 0;
      |        ^
a.cc:37:11: error: invalid types 'int[int]' for array subscript
   37 |       left[i+1] = 0;
      |           ^
a.cc:38:10: error: invalid types 'int[int]' for array subscript
   38 |       ans[i+1] = 0;
      |          ^
a.cc:61:11: error: invalid types 'int[int]' for array subscript
   61 |     if(ans[i] == -1){
      |           ^
a.cc:62:10: error: invalid types 'int[int]' for array subscript
   62 |       ans[i] = right[i] > left[i] ? right[i] : left[i];
      |          ^
a.cc:62:31: error: invalid types 'int[int]' for array subscript
   62 |       ans[i] = right[i] > left[i] ? right[i] : left[i];
      |                               ^
a.cc:62:52: error: invalid types 'int[int]' for array subscript
   62 |       ans[i] = right[i] > left[i] ? right[i] : left[i];
      |                                                    ^
a.cc:64:15: error: invalid types 'int[int]' for array subscript
   64 |     sum += ans[i];
      |               ^
a.cc:70:12: error: type 'int' argument given to 'delete', expected pointer
   70 |   delete[] left;
      |            ^~~~
a.cc:71:12: error: type 'int' argument given to 'delete', expected pointer
   71 |   delete []ans;
      |            ^~~