n = int(input())
for _ in range(n):
	input()
	s = input()
	k = len(s)
	if len(s) < 2 or len(set(s)) < 2:
		print(0)
		continue
		
	ans = k + 1
	#<<<<<<<<<<<>>>
	for i in range(k):
		if s[i] == '>' and '<' not in s[i:]:
			ans = min(ans, k - i, i)
			break

#<<<<>>>>>
	for i in range(k - 1, -1, -1):
		if s[i] == '<' and '>' not in s[:i]:
			ans = min(ans, k - i, i)
			break

	if ans == k + 1:
		ans = 0

	print(ans)
