Example

Input

7
>>


Output

7
#include <iostream>
#include <algorithm>
using namespace std;
//R := >
//L := <
int cntR[100000];
int cntL[100000];

int main(){
    string S;
    int N;
    cin>>N;
    cin>>S;
    cntR[0]+=S[0]=='>';
    cntL[0]+=S[0]=='<';
    for(int i=1;i<N;i++){
        cntR[i]=cntR[i-1]+(S[i]=='>');
        cntL[i]=cntL[i-1]+(S[i]=='<');
    }
    int ans = 0;
    for(int i=0,idx=0;i<N;i++){
        while(cntL[idx]-cntL[i]<cntR[i]&&idx<N)idx++;
        if(idx==N) break;
        ans = max(ans,idx+1);
    }
    for(int i=N-1,idx=N-1;i>=0;i--){
        while(cntR[i]-(idx?cntR[idx-1]:0)<cntL[N-1]-cntL[i]&&idx>=0)idx--;
        if(idx<0) break;
        ans = max(ans,N-idx);
    }
    cout<<ans<<endl;
    return 0;
}