Example

Input

7
>>


Output

7
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  string S;
  cin >> S;
  vector<int> L(N + 1);
  L[0] = 0;
  for (int i = 0; i < N; i++){
    if (S[i] == '>'){
      L[i + 1] = L[i] + 1;
    } else {
      L[i + 1] = L[i];
    }
  }
  vector<int> R(N + 1);
  R[N] = 0;
  for (int i = N - 1; i >= 0; i--){
    if (S[i] == '<'){
      R[i] = R[i + 1] + 1;
    } else {
      R[i] = R[i + 1];
    }
  }
  int ans = 0;
  for (int i = 0; i < N; i++){
    int tmp;
    if (S[i] == '>'){
      if (L[i + 1] > R[i + 1]){
        tmp = L.end() - lower_bound(L.begin(), L.end(), L[i + 1] - R[i + 1]);
      } else {
        tmp = R.rend() - upper_bound(R.rbegin(), R.rend(), R[i + 1] - L[i + 1]);
      }
    }
    if (S[i] == '<'){
      if (L[i] >= R[i]){
        tmp = L.end() - upper_bound(L.begin(), L.end(), L[i] - R[i]);
      } else {
        tmp = R.rend() - upper_bound(R.rbegin(), R.rend(), R[i] - L[i] - 1);
      }
    }
    ans = max(ans, tmp);
  }
  cout << ans << endl;
}
