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

	print(ans)
