Example

Input

7
>>


Output

7
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <cfloat>

using std::cerr;
using std::cin;
using std::cout;
using std::endl;

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

  int n;
  std::string s;
  cin>>n>>s;
  int cum_right[100001]={};
  int cum_left[100001]={};
  std::unordered_map<int,int> cummap_r,cummap_l;
  if(s[0]=='>'){
    cum_right[0]=1;
    cummap_r[1]=0;
  }else{
    cum_left[0]=1;
    cummap_l[1]=0;
  }

  for(int i=1;i<n;i++){
    cum_left[i]=cum_left[i-1];
    cum_right[i]=cum_right[i-1];
    if(s[i]=='>'){
      cum_right[i]++;
      cummap_r[cum_right[i]]=i;

    }else{
      cum_left[i]++;
      cummap_l[cum_left[i]]=i;
    }
  }

  int result=0;
  for(int i=0;i<n;i++){

    int r=(i==0?0:cum_right[i-1]);
    int l=cum_left[n-1]-cum_left[i];
    int tmp;

    if(s[i]=='<'){

if(r<=l){
        tmp=cummap_l[r+cum_left[i]]+1;

      }else{
        tmp=n-cummap_r[cum_right[i]-l];

      }
    }else{
      if(r<l){
        tmp=cummap_l[r+1+cum_left[i]]+1;

      }

      else{
        tmp=n-cummap_r[cum_right[i]-l];

      }
    }
    result=std::max(result,tmp);
  }

  cout<<std::min(result,n)<<endl;



  return 0;
}
