from os import path
import sys,time
# mod = int(1e9 + 7)
# import re
from math import ceil, floor,gcd,log,log2 ,factorial
from collections import defaultdict ,Counter , OrderedDict , deque
from itertools import combinations , groupby , zip_longest
# from string import ascii_lowercase ,ascii_uppercase
# from bisect import *
from functools import reduce
from operator import mul
maxx = float('inf')
#----------------------------INPUT FUNCTIONS------------------------------------------#
I = lambda :int(sys.stdin.buffer.readline())
tup= lambda : map(int , sys.stdin.buffer.readline().split())
lint = lambda :[int(x) for x in sys.stdin.buffer.readline().split()]
S = lambda: sys.stdin.readline().strip('\n')
grid = lambda  r :[lint() for i in range(r)]
stpr = lambda x : sys.stdout.write(f'{x}' + '\n')
star = lambda x: print(' '.join(map(str, x)))

localsys = 0
start_time = time.time()
if (path.exists('input.txt')):
	sys.stdin=open('input.txt','r');sys.stdout=open('output.txt','w');
#left shift --- num*(2**k) --(k - shift)
input = sys.stdin.readline

for _ in range(I()):
	n = int(input())
	s = input().rstrip()
	if _ == 7:
		print(s)
		continue
	if len(set(s)) == 1:
		print(0)
		continue
	cnt1 = s.count('<')
	cnt2 = n - cnt1
	ans , i ,st =0 , 0 , []
	while i < n:
		if st:
			if st[-1] =='<' and s[i] =='>':
				if cnt1 > cnt2:
					cnt2-=1
				else:
					st.pop()
					cnt1-=1
				ans+=1
			else:
				st.append(s[i])
		else:
			st.append(s[i])
		i+=1
	print(ans)


















if localsys:
	print("\n\nTime Elased :",time.time() - start_time,"seconds")


