'''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())
	mystack = []
	for i in range(n):
		#print(mystack)
		if len(mystack) == 0:
			mystack.append(string[i])
			continue
		if string[i] == '<':
				while len(mystack) > 0:
					mystack.pop()
				mystack.append(string[i])
		else: 
			if mystack[-1] == '>':	
				pass
			else:
				mystack.append(string[i])
	string = mystack
	mystack = []
	for i in range(len(string)):
		if len(mystack) == 0:
			mystack.append(string[i])
			continue
		elif string[i] == '>':
			mystack.append(string[i])
			break
		else:
			while len(mystack) > 0:
				mystack.pop()
			mystack.append(string[i])



	#print(mystack)	
	print(len(mystack) - 1)		

		