Example

Input

7
>>


Output

7
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;
#define BIG_NUM 2000000000
using namespace std;

int main(){

	int N,left = 1,right = 1,length,ans = 0;

	scanf("%d",&N);

	if(N==1){
		printf("1\n");
		return 0;
	}

	int* RIGHT = new int[N];
	int* LEFT  = new int[N];
	int* LOC_R = new int[N];
	int* LOC_L = new int[N];
 	for(int i = 0; i < N; i++){
		RIGHT[i] = 0;
		LEFT[i] = 0;
	}

	char* buf = new char[N+1];
	scanf("%s",buf);

	for(length = 0; buf[length] != '\0'; length++){
		if(buf[length] == '>'){
			RIGHT[length] = right;
			LOC_R[right] = length;
			right++;
		}
	}
	for(int i = 1; i < length; i++){
		if(RIGHT[i] == 0)RIGHT[i] = RIGHT[i-1];
	}

	for(int i = length-1; i >= 0; i--){
		if(buf[i] == '<'){
			LEFT[i] = left;
			LOC_L[left] = i;
			left++;
		}
	}
	for(int i = length-2; i >= 0; i--){
		if(LEFT[i] == 0)LEFT[i] = LEFT[i+1];
	}

	for(int i = 0; i < length; i++){
		if(buf[i] == '>'){
			if(i == length-1){
				ans = max(ans,1);
			}else{
				if(RIGHT[i] > LEFT[i+1]){
					ans = max(ans,N-(LOC_R[RIGHT[i]-LEFT[i+1]]));
				}else{
					ans = max(ans,LOC_L[LEFT[i]+1-RIGHT[i]]+1);
				}
			}
		}else{
			if(i == 0){
				ans = max(ans,1);
			}else{
				if(RIGHT[i-1] >= LEFT[i]){
					ans = max(ans,N-(LOC_R[RIGHT[i]+1-LEFT[i]]));
				}else{
					ans = max(ans,LOC_L[LEFT[i]-RIGHT[i]]+1);
				}
			}
		}
	}

	printf("%d\n",ans);

	return 0;
}