"""609C"""
# import math
# import sys
def  main():
	n = int(input())
	string = str(input())
	cnt = 0
	flag = True
	for i in range(n-1):
		if string[i]!=string[i+1]:
			flag = False
			break
	if flag:
		print(0)
		return
	else:
		index = -1
		for i in range(n):
			if string[i]=='>':
				index = i
		if index==0:
			print(0)
		else:
			print(index+1)
	return

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