'''input
3
2
<>
3
><<
1
>
'''
from sys import stdin, stdout
import math


# main starts
t = int(stdin.readline().strip())
for _ in range(t):
	n = int(stdin.readline().strip())
	string = list(stdin.readline().strip())
	
	first = 0
	second = 0
	for i in range(n):
		if string[i] == '>':
			first = i
	for i in range(n -1 , -1, -1):
		if string[i] == '<':
			second = n - 1 - i
	print(min(first, second))