"""609C"""
# import math
# import sys
def  main():
	n = int(input())
	string = str(input())
	index = n+1
	index2 = n+1
	for i in range(n):
		if string[i]==">":
			index = i 
			break
	for i in range(n-1,-1,-1):
		if string[i]=="<":
			index2=i
			break
	print(min(index2,index))
	return

# main()
def test():
	t = int(input())
	while t:
		main()
		t-=1
test()
