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

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

	if ans == k + 1 or len(s) < 2:
		ans = 0

	print(ans)
