t = int(input())

for i in range(t):
	n = int(input())
	s = input()
	s = "?" + s + "?"
	k1 = s[:]
	k2 = s[:]
	arr1 = []
	count12 = 0
	count21= 0
	count11, count22 = 0, 0
	for j in range(n+2):
		arr1 += [s[j]]

	j = 1
	while arr1[j] != "?":
		if arr1[j] == ">" and arr1[j+1] != "?":
			arr1.pop(j+1)
		else:
			j += 1
	# print(arr1)
	for j in range(len(arr1)):
		if arr1[j] == ">":
			count11 += 1
		else:
			if arr1[j] != "?":
				count12 += 1

	arr1 = []
	for j in range(n+2):
		arr1 += [s[j]]

	j = n
	while arr1[j] != "?":
		if arr1[j] == "<" and arr1[j-1] != "?":
			arr1.pop(j-1)
		else:
			j -= 1
	# print(arr1)
	for j in range(len(arr1)-1, 0, -1):
		if arr1[j] == "<":
			count21 += 1
		else:
			if arr1[j] != "?":
				count22 += 1

	print(min(count11, count22, count21, count12))



