Example

Input

7
>>


Output

7
#include<iostream>
#include<algorithm>
using namespace std;
int n;
string s;
int sum[1<<17];
int sumR[1<<17];
int main()
{
	cin>>n>>s;
	for(int i=0;i<n;i++)sum[i+1]=sum[i]+(s[i]=='>');
	for(int i=0;i<n;i++)sumR[i+1]=sumR[i]+(s[n-i-1]=='<');
	int ans=0;
	for(int i=0;i<n;i++)
	{
		int L=sum[i];
		int R=(n-i-1)-(sum[n]-sum[i+1]);
		int now;
		if(s[i]=='>')
		{
			if(L>=R)
			{
				int pos=lower_bound(sum,sum+n+1,L-R+1)-sum-1;
				now=n-pos;
			}
			else
			{
				int pos=lower_bound(sumR,sumR+n+1,R-L)-sumR-1;
				now=n-pos;
			}
		}
		else
		{
			if(L<=R)
			{
				int pos=lower_bound(sumR,sumR+n+1,R-L+1)-sumR-1;
				now=n-pos;
			}
			else
			{
				int pos=lower_bound(sum,sum+n+1,L-R)-sum-1;
				now=n-pos;
			}
		}
		ans=max(ans,now);
	}
	cout<<ans<<endl;
}

