You have a string $s$ of length $n$ consisting of only characters > and <. You may do some operations with this string, for each operation you have to choose some character that still remains in the string. If you choose a character >, the character that comes right after it is deleted (if the character you chose was the last one, nothing happens). If you choose a character <, the character that comes right before it is deleted (if the character you chose was the first one, nothing happens).

For example, if we choose character > in string > > < >, the string will become to > > >. And if we choose character < in string > <, the string will become to <.

The string is good if there is a sequence of operations such that after performing it only one character will remain in the string. For example, the strings >, > > are good. 

Before applying the operations, you may remove any number of characters from the given string (possibly none, possibly up to $n - 1$, but not the whole string). You need to calculate the minimum number of characters to be deleted from string $s$ so that it becomes good.


-----Input-----

The first line contains one integer $t$ ($1 \le t \le 100$) – the number of test cases. Each test case is represented by two lines.

The first line of $i$-th test case contains one integer $n$ ($1 \le n \le 100$) – the length of string $s$.

The second line of $i$-th test case contains string $s$, consisting of only characters > and <.


-----Output-----

For each test case print one line.

For $i$-th test case print the minimum number of characters to be deleted from string $s$ so that it becomes good.


-----Example-----
Input
3
2
<>
3
><<
1
>

Output
1
0
0



-----Note-----

In the first test case we can delete any character in string <>.

In the second test case we don't need to delete any characters. The string > < < is good, because we can perform the following sequence of operations: > < < $\rightarrow$ < < $\rightarrow$ <.

Difficulty: EASY

Solutions:
T = int(input())
for t in range(0, T):
	n = int(input())
	s = input()
	i = 0
	while i < n and s[i] == '<':
		i += 1
	j = n - 1
	while j >= 0 and s[j] == '>':
		j -= 1
	print(min(i, n - j - 1))


for _ in range(int(input())):
	n = int(input())
	st = input()
	left = -1
	right = -1
	for i in range(n):
		if st[i] == '>':
			if right == -1:
				right = i
		else:
			left = i + 1
	print(max(min(right, n - left), 0))


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	s2 = s[::-1]
	(a, b) = (0, 0)
	if '>' in s:
		a = s.index('>')
	if '<' in s:
		b = s2.index('<')
	print(min(a, b))


import re, math, decimal, bisect

def read():
	return input().strip()

def iread():
	return int(input().strip())

def viread():
	return [int(_) for _ in input().strip().split()]
for i in range(iread()):
	n = iread()
	s = read()
	print(min(max(s.find('>'), 0), max(s[::-1].find('<'), 0)))


n = int(input())
Ka = 0
Cnt = 0
for i in range(n):
	G = int(input())
	S = input()
	if len(set(S)) == 1:
		print(0)
	else:
		S = list(S)
		K = 0
		while len(S) >= 2 and S[0] == '<' and (S[-1] == '>'):
			K += 1
			S = S[1:-1]
		print(K)


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	a = 0
	b = 0
	if s[0] == '<' and s[n - 1] == '>':
		for i in range(n):
			if s[i] != '>':
				a = a + 1
			else:
				break
		for i in range(n - 1, -1, -1):
			if s[i] != '<':
				b = b + 1
			else:
				break
		print(min(a, b))
	else:
		print(0)


for i in range(int(input())):
	n = int(input())
	st = input()
	k = 0
	for j in range(n):
		if st[j] == '>':
			k = j
			break
	e = 0
	st = st[::-1]
	for j in range(n):
		if st[j] == '<':
			e = j
			break
	print(min(e, k))


def Solve(s, n):
	if s[0] == '>' or s[-1] == '<':
		print(0)
		return
	count = 0
	min_count = float('inf')
	for i in range(n):
		if s[i] == '<':
			count += 1
		else:
			min_count = count
			break
	count = 0
	for i in range(n - 1, -1, -1):
		if s[i] == '>':
			count += 1
		else:
			break
	print(min(count, min_count))

def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		s = input()
		Solve(s, n)
main()


for z in range(int(input())):
	n = int(input())
	s = input()
	a = []
	c1 = 0
	c2 = 0
	for i in range(n):
		if s[i] == '>':
			a.append(0)
		else:
			a.append(1)
	if a[0] == 0 or a[n - 1] == 1:
		print(0)
	elif a[0] == 1 and a[n - 1] == 0:
		ans = 99999999
		for i in range(n - 1):
			if a[i] == 1 and a[i + 1] == 0:
				ans = min(ans, i + 1, n - i - 1)
			elif a[i] == 0 and a[i + 1] == 1:
				ans = min(ans, i + 1, n - i - 1)
		print(ans)


import sys
t = int(sys.stdin.readline())

def doRequests(t):
	for req in range(t):
		n = int(sys.stdin.readline())
		s = sys.stdin.readline().strip()
		badSit = 0
		while badSit < n and (s[badSit] == '<' and s[-1 - badSit] == '>'):
			badSit += 1
		print(badSit)
doRequests(t)


for i in range(int(input())):
	(n, s) = (int(input()), input())
	(ix1, ix2) = (s[::-1].find('<'), s.find('>'))
	if ix1 == -1 or ix2 == -1:
		print(0)
	else:
		print(min(ix1, ix2))


t = int(input())
for test in range(0, t):
	n = int(input())
	s = input()
	prefix_len = 0
	suffix_len = 0
	for i in range(0, n):
		if s[i] == '<':
			prefix_len += 1
		else:
			break
	for i in range(n - 1, -1, -1):
		if s[i] == '>':
			suffix_len += 1
		else:
			break
	print(min(suffix_len, prefix_len))


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	if s[0] == '>' or s[-1] == '<':
		print(0)
	else:
		q = 0
		w = 0
		for j in s:
			if j == '<':
				q += 1
			else:
				break
		for j in range(len(s) - 1, -1, -1):
			if s[j] == '>':
				w += 1
			else:
				break
		print(min(q, w))


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	if '>' in s and '<' in s:
		print(min(s.find('>'), n - 1 - s.rfind('<')))
	else:
		print(0)


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	head = 0
	end = 0
	for j in s:
		if j == '<':
			head += 1
		else:
			break
	for j in range(n - 1, -1, -1):
		if s[j] == '>':
			end += 1
		else:
			break
	print(min(head, end))


t = int(input())
for i in range(t):
	flaggt = 1
	gt = 0
	lt = 0
	ans = 0
	flaglt = 1
	n = int(input())
	s = list(input())
	for j in range(n):
		if flaggt:
			if s[j] == '>':
				gt = j
				ans = gt
				flaggt = 0
				break
		if flaglt:
			if s[n - j - 1] == '<':
				lt = j
				ans = lt
				flaglt = 0
				break
	print(ans)


t = int(input())
for i in range(0, t):
	n = int(input())
	s = str(input())
	if (s[0] == '<') & (s[n - 1] == '>'):
		cnt1 = 0
		j = 0
		while (j < n) & (s[j] == '<'):
			cnt1 += 1
			j += 1
		cnt2 = 0
		j = n - 1
		while (j >= 0) & (s[j] == '>'):
			cnt2 += 1
			j -= 1
		cnt1 = min(cnt1, cnt2)
		print(cnt1)
	else:
		print('0')


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	if s[0] == '>' or s[-1] == '<':
		print(0)
		continue
	else:
		from_l = 0
		from_r = 0
		for i in range(n):
			if s[i] == '>':
				from_l = i
				break
		for i in range(n - 1, -1, -1):
			if s[i] == '<':
				from_r = n - i - 1
				break
		print(min(from_l, from_r))


t = int(input())
for j in range(t):
	n = int(input())
	string = input()
	lcounter = 0
	rcounter = 0
	changed = False
	for i in range(n):
		if string[i] == '<' and (not changed):
			lcounter += 1
		if string[i] != '<':
			changed = True
			break
	changed = False
	string = string[::-1]
	for i in range(n):
		if string[i] == '>' and (not changed):
			rcounter += 1
		if string[i] != '>':
			changed = True
			break
	print(min(lcounter, rcounter))


tests = int(input())
for _ in range(tests):
	n = int(input())
	s = list(input())
	right_encountered = -1
	cost_from_left = 0
	for i in range(n):
		if s[i] == '<':
			if right_encountered == 1:
				continue
			cost_from_left += 1
		else:
			right_encountered = 1
	left_encountered = -1
	cost_from_right = 0
	for i in range(n - 1, -1, -1):
		if s[i] == '>':
			if left_encountered == 1:
				continue
			cost_from_right += 1
		else:
			left_encountered = 1
	print(min(cost_from_left, cost_from_right))


t = int(input())
for a0 in range(t):
	n = int(input())
	s = input()
	x = 0
	y = 0
	for i in range(n):
		if s[i] == '>':
			x = i
			break
	s = s[::-1]
	for i in range(n):
		if s[i] == '<':
			y = i
			break
	print(min(x, y))


for _ in range(int(input())):
	n = int(input())
	s = input()
	ans = 0
	for i in range(n):
		if s[i] is '>':
			ans = i
			break
	for i in range(n - 1, -1, -1):
		if s[i] is '<':
			ans = min(n - 1 - i, ans)
			break
	print(ans)


t = int(input())
for i in range(t):
	_ = input()
	s = input()
	if s[0] == '<' and s[-1] == '>':
		j = 0
		h = len(s) - 1
		start = True
		end = True
		while start == end == True and j < h:
			j += 1
			h -= 1
			if s[j] == '>':
				start = False
			if s[h] == '<':
				end = False
		print(j)
	else:
		print(0)


num_test = int(input())
list1 = []
list2 = []
for i in range(num_test):
	list1.append(int(input()))
	list2.append([x for x in input().split()])
a = sum(list2, [])

def min_operation(s):
	try:
		first = s.index('>')
		last = len(s) - s.rindex('<') - 1
		return min(first, last)
	except:
		return 0
for i in range(len(list1)):
	print(min_operation(a[i]))


testCases = int(input().strip())
strings = []
for i in range(testCases):
	length = int(input().strip())
	strings.append(input().strip())
for s in strings:
	left = 0
	right = 0
	if '>' in s:
		left = s.index('>')
	if '<' in s:
		right = s[::-1].index('<')
	print(min(left, right))


for i in range(int(input())):
	size = int(input())
	inpu = input()
	a = 0
	b = 0
	if inpu[0] == '<' and inpu[-1] == '>':
		a = inpu.find('>')
		b = size - 1 - inpu.rfind('<')
	print(min(a, b))


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	l1 = len(s)
	if s[0] == '<' and s[-1] == '>':
		c1 = 0
		i = 0
		while s[i] != '>':
			i = i + 1
			c1 = c1 + 1
		c2 = 0
		i = n - 1
		while s[i] != '<':
			i = i - 1
			c2 = c2 + 1
		print(min(c1, c2))
	else:
		print(0)


for _ in ' ' * int(input()):
	(n, s, c, b) = (int(input()), input(), 0, 0)
	if s[0] == '<' and s[-1] == '>':
		for i in s:
			if i == '<':
				c += 1
			else:
				break
		s = s[::-1]
		for i in s:
			if i == '>':
				b += 1
			else:
				break
	print(min(c, b))


import sys
num_tests = int(sys.stdin.readline())
results = []
for i in range(num_tests):
	length = int(sys.stdin.readline())
	string = sys.stdin.readline().strip()
	count = 0
	for i in range(length):
		if string[i] == '<' and string[-1 * (i + 1)] == '>':
			count += 1
		else:
			break
	results.append(count)
for r in results:
	print(r)


def main():
	t = int(input())
	for kase in range(t):
		n = int(input())
		s = input()
		lc = 0
		while lc < n and s[lc] == '<':
			lc += 1
		rc = 0
		while rc < n and s[n - rc - 1] == '>':
			rc += 1
		print(min(lc, rc))
exit(main())


numCases = int(input())
while numCases > 0:
	input()
	string = input()
	if len(string) < 2:
		print(0)
	elif string.count('<') == 0 or string.count('>') == 0:
		print(0)
	else:
		print(min(string.index('>'), len(string) - 1 - string.rindex('<')))
	numCases -= 1


t = int(input())
for i in range(t):
	n = int(input())
	count1 = count2 = 0
	string = str(input())
	if string[0] == '<' and string[n - 1] == '>':
		for j in range(0, n, 1):
			if string[j] == '<':
				count1 += 1
			else:
				break
		for j in range(n - 1, -1, -1):
			if string[j] == '>':
				count2 += 1
			else:
				break
		print(min(count1, count2))
	else:
		print(0)


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	pos = 0
	for i in range(n):
		if s[i] == '>' or s[n - 1 - i] == '<':
			pos = i
			break
	print(pos)


for T in range(int(input())):
	N = int(input())
	st = input()
	l = 0
	r = 0
	for c in st:
		if c == '<':
			l += 1
		else:
			break
	for c in st[::-1]:
		if c == '>':
			r += 1
		else:
			break
	print(min(l, r))


for _ in range(int(input())):
	n = int(input())
	s = input()
	if s[0] == '>' or s[n - 1] == '<':
		print(0)
	elif '<>' not in s:
		print(0)
	else:
		g = 0
		l = 0
		for i in range(n):
			if s[i] == '>':
				g = i
				break
		for i in range(n - 1, 0, -1):
			if s[i] == '<':
				break
			l += 1
		print(min(g, l))


for _ in range(int(input())):
	n = int(input())
	s = list(input())
	flag1 = 0
	flag2 = 0
	t1 = 0
	t2 = 0
	for i in range(n):
		if s[i] == '>':
			flag1 = 1
			t1 = i
			break
	for i in range(n - 1, -1, -1):
		if s[i] == '<':
			t2 = i
			flag2 = 1
			break
	if flag2 == 1 and flag1 == 1:
		print(min(t1, n - t2 - 1))
	else:
		print(0)


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	if n == 1:
		print(0)
	else:
		ct1 = 0
		ct2 = 0
		for x in range(len(s)):
			if s[x] == '<':
				ct1 += 1
			else:
				break
		for y in range(len(s) - 1, -1, -1):
			if s[y] == '>':
				ct2 += 1
			else:
				break
		print(min(ct1, ct2))


for _ in range(int(input())):
	n = int(input())
	s = list(input())
	(x, y) = (-1, -1)
	for i in range(n):
		if s[i] == '>':
			x = i
			break
	for i in range(n - 1, -1, -1):
		if s[i] == '<':
			y = n - 1 - i
			break
	if x == -1 or y == -1:
		print(0)
	else:
		print(min(x, y))


t = int(input())
for tt in range(t):
	n = int(input())
	s = input()
	l = s.find('>')
	r = s.rfind('<')
	if l < 0 or r < 0:
		print(0)
	else:
		r = n - r - 1
		print(min(l, r))


for _ in range(int(input())):
	n = int(input())
	s = input()
	a1 = a2 = 0
	for i in range(n):
		if s[i] != '<':
			break
		a1 += 1
	for i in range(n - 1, -1, -1):
		if s[i] != '>':
			break
		a2 += 1
	print(min(a1, a2))


a = []
n = int(input())
for i in range(0, n):
	m = int(input())
	s = input()
	ma = m
	m = 0
	for j in range(0, len(s)):
		if s[j] == '<':
			m = m + 1
		elif m < ma:
			ma = m
			break
	m = 0
	for j in reversed(range(len(s))):
		if s[j] == '>':
			m = m + 1
		elif m < ma:
			ma = m
			break
	a.append(ma)
for i in range(0, len(a)):
	print(a[i])


t = int(input())
n_list = []
s_list = []
for i in range(t):
	n_list.append(int(input()))
	s_list.append(input())
ans = []
for i in range(t):
	n = n_list[i]
	s = s_list[i]
	cnt = 0
	if s[0] == '<':
		if s[-1] == '<':
			ans.append(0)
		else:
			one = 0
			two = 0
			for j in range(n):
				if s[j] == '<':
					one += 1
				else:
					break
			for j in range(n):
				if s[-(j + 1)] == '>':
					two += 1
				else:
					break
			ans.append(min(one, two))
	else:
		ans.append(0)
for a in ans:
	print(a)


for t in range(int(input())):
	n = int(input())
	a = input()
	count1 = 0
	count2 = 0
	for i in a:
		if i == '<':
			count1 += 1
		else:
			break
	a = a[::-1]
	for i in a:
		if i == '>':
			count2 += 1
		else:
			break
	print(min(count1, count2))


from sys import stdin, stdout
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
mod = 1000000007
tc = ii1()
for _ in range(tc):
	n = ii1()
	s = is1()
	if s[0] == '>' or s[-1] == '<':
		print(0)
	else:
		c1 = 0
		for i in s:
			if i == '<':
				c1 += 1
			else:
				break
		c2 = 0
		for i in s[::-1]:
			if i == '>':
				c2 += 1
			else:
				break
		print(min(c1, c2))


z = int(input())
for i in range(z):
	x = int(input())
	s = str(input())
	a = s.count('>')
	b = s.count('<')
	if a == 0 or b == 0:
		print(0)
	else:
		m = []
		if s[0] == '<':
			for j in range(0, len(s)):
				if s[j] == '<':
					m.append(j)
				else:
					break
		n = []
		if s[len(s) - 1] == '>':
			s = s[::-1]
			for j in range(0, len(s)):
				if s[j] == '>':
					n.append(j)
				else:
					break
		g = min(len(n), len(m))
		print(g)


from math import *
from collections import *
import sys
sys.setrecursionlimit(10 ** 9)
t = int(input())
for y in range(t):
	n = int(input())
	a = input()
	ct = ct1 = 0
	for i in range(n):
		if a[i] == '>':
			ct = i
			break
	for i in range(n - 1, -1, -1):
		if a[i] == '<':
			ct1 = n - 1 - i
			break
	print(min(ct, ct1))


for _ in range(int(input())):
	n = int(input())
	s = input()
	if s[0] == s[n - 1] or s[0] == '>' or s[n - 1] == '<':
		print('0')
	else:
		i = 0
		a = 0
		while s[i] == '<':
			a += 1
			i += 1
		j = n - 1
		b = 0
		while s[j] == '>':
			b += 1
			j -= 1
		print(min(a, b))


T = int(input())
for _ in range(T):
	N = int(input())
	S = input()
	before = 0
	for c in S:
		if c == '<':
			before += 1
		else:
			break
	if before == N:
		print(0)
		continue
	after = 0
	for i in range(N - 1, -1, -1):
		if S[i] == '>':
			after += 1
		else:
			break
	print(min(before, after))


t = int(input())
ans = [0] * t
for i in range(t):
	n = int(input())
	s = input()
	for j in range(n):
		if s[j] + s[-j - 1] != '<>':
			ans[i] = j
			break
for i in range(t):
	print(ans[i])


rs = lambda : int(input())
ri = lambda : map(int, input().split())
rli = lambda : list(map(int, input().split()))
n = int(input())
for i in range(n):
	k = int(input())
	s = input()
	ans = k - 1
	ans1 = 0
	while ans1 < k and s[ans1] == '<':
		ans1 += 1
	ans2 = 0
	while k - 1 - ans2 >= 0 and s[k - 1 - ans2] == '>':
		ans2 += 1
	ans = min([ans, ans2, ans1])
	print(ans)


n = int(input())
while n != 0:
	k = int(input())
	a = list(input())
	ans = 0
	for i in range(k):
		if a[i] == '<':
			ans = max(ans, i + 1)
		else:
			ans = max(ans, k - i)
	print(k - ans)
	n -= 1


n = int(input())
for _ in range(n):
	m = int(input())
	s = input()
	if '<' not in s:
		print(0)
	elif '>' not in s:
		print(0)
	else:
		print(min(s.index('>'), m - 1 - s.rindex('<')))


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	i = 0
	while s[i] == '<':
		i += 1
		if i == n:
			break
	j = 0
	while s[-j - 1] == '>':
		j += 1
		if j == n:
			break
	print(min(i, j))


for _ in range(int(input())):
	n = int(input())
	a = input()
	if n == 1:
		print(0)
		continue
	if a[0] == '<' and a[-1] == '>':
		c1 = c2 = 0
		for x in a:
			if x == '<':
				c1 += 1
			else:
				break
		for x in a[::-1]:
			if x == '>':
				c2 += 1
			else:
				break
		print(min(c1, c2))
		continue
	print(0)


I = lambda : map(int, input().split())
n1 = int(input())
for _ in range(n1):
	n = int(input())
	st = input()
	x1 = st.count('<')
	x2 = st.count('>')
	if x1 == 0 or x2 == 0:
		print('0')
		continue
	for i in range(n):
		if st[i] == '>':
			right = i
			break
	for i in range(n - 1, -1, -1):
		if st[i] == '<':
			left = i
			break
	maxx = min(right, n - 1 - left)
	print(maxx)


import sys
from collections import defaultdict as dd
from itertools import permutations as pp
from itertools import combinations as cc
from collections import Counter as ccd
from random import randint as rd
from bisect import bisect_left as bl
import heapq
mod = 10 ** 9 + 7

def ri(flag=0):
	if flag == 0:
		return [int(i) for i in sys.stdin.readline().split()]
	else:
		return int(sys.stdin.readline())
for i in range(ri(1)):
	n = ri(1)
	a = input()
	one = 0
	two = 0
	i = 0
	while i < n:
		if a[i] == '<':
			one += 1
		else:
			break
		i += 1
	i = n - 1
	while i > -1:
		if a[i] == '>':
			two += 1
		else:
			break
		i -= 1
	print(min(one, two))


from sys import stdin, stdout
import math
t = int(stdin.readline().strip())
for _ in range(t):
	n = int(stdin.readline().strip())
	string = list(stdin.readline().strip())
	first = 0
	second = 0
	for i in range(n):
		if string[i] == '>':
			first = i
			break
	for i in range(n - 1, -1, -1):
		if string[i] == '<':
			second = n - 1 - i
			break
	print(min(first, second))


for t in range(int(input())):
	n = int(input())
	s = input()
	if '>' in s and '<' in s:
		a = s.index('>')
		b = s[::-1].index('<')
		print(min(a, b))
	else:
		print(0)


n = int(input())
cases = [list(input().split()) for i in range(2 * n)]
for i in range(n):
	s = cases[2 * i + 1][0]
	j = 0
	count = 0
	while s[j] == '<' and s[len(s) - 1 - j] == '>':
		count += 1
		j += 1
	print(count)


import math
t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	s = list(s)
	r = []
	r[:] = s[::-1]
	if n == 1:
		print(0)
	elif '>' not in s or '<' not in s:
		print(0)
	else:
		print(min(s.index('>'), r.index('<')))


for _ in range(int(input())):
	n = int(input())
	s = input()
	res = n
	for i in range(n):
		if s[i] == '>':
			res = min(res, i)
		else:
			res = min(res, n - i - 1)
	print(res)


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	if n == 1:
		print(0)
	elif s[0] == '>':
		print(0)
	elif s[-1] == '<':
		print(0)
	else:
		x = s.find('>')
		y = s.rfind('<')
		y = n - y - 1
		print(min(max(0, x), min(n, y)))


def solve(s):
	left_gt = s.find('>')
	right_lt = s.rfind('<')
	if left_gt == -1:
		return 0
	if right_lt == -1:
		return 0
	if left_gt < right_lt:
		return min(left_gt, len(s) - right_lt - 1)
	return min(right_lt + 1, len(s) - left_gt)
t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	print(solve(s))


def get_ints():
	return list(map(int, input().split()))
for _ in range(int(input())):
	n = int(input())
	s = input()
	if '>' in s and '<' in s:
		print(min(s.index('>'), s[::-1].index('<')))
	else:
		print(0)


for _ in range(int(input())):
	(n, s, L, R) = (int(input()), input(), 0, 0)
	while L < n and s[L] == '<':
		L += 1
	while R < n and s[-R - 1] == '>':
		R += 1
	print(min(L, R))


R = lambda : map(int, input().split())
for _ in range(int(input())):
	n = int(input())
	s = input()
	if s[0] == '<' and s[n - 1] == '>':
		i = 0
		(c1, c2) = (0, 0)
		while i < n:
			if s[i] == '>':
				break
			c1 += 1
			i += 1
		i = n - 1
		while i >= 0:
			if s[i] == '<':
				break
			c2 += 1
			i -= 1
		print(min(c1, c2))
	else:
		print(0)


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	c1 = 0
	c2 = 0
	if s[0] == '<' and s[-1] == '>':
		for i in range(n):
			if s[i] != '<':
				break
			c1 = c1 + 1
		for i in range(n):
			if s[-i - 1] != '>':
				break
			c2 = c2 + 1
		print(min(c1, c2))
	else:
		print(0)


for s in [*open(0)][2::2]:
	s = s.strip()
	print(len(s) - max(map(len, (s.lstrip('<'), s.rstrip('>')))))


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	num = s.find('>')
	num2 = s.rfind('<')
	if num == -1 or num2 == -1:
		print(0)
	else:
		print(min(num, n - 1 - num2))


from collections import defaultdict
from functools import reduce
mi = lambda : [int(i) for i in input().split()]
flat = lambda l: reduce(lambda a, b: a + b, l)
t = mi()[0]
for _ in range(t):
	n = mi()[0]
	s = input()
	print(min(len(s) - len(s.lstrip('<')), len(s) - len(s.rstrip('>'))))


t = int(input())
for j in range(t):
	n = int(input())
	s = input()
	ct1 = 0
	for i in s:
		if i == '<':
			ct1 += 1
		else:
			break
	ct2 = 0
	for i in s[::-1]:
		if i == '>':
			ct2 += 1
		else:
			break
	print(min(ct1, ct2))


import sys
input = sys.stdin.readline
INF = 10 ** 18
t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	ans = INF
	cnt = 0
	for i in range(n):
		if s[i] == '<':
			cnt += 1
		else:
			break
	ans = min(cnt, ans)
	cnt = 0
	for i in range(n)[::-1]:
		if s[i] == '>':
			cnt += 1
		else:
			break
	ans = min(cnt, ans)
	print(ans)


import sys

class BGoodString:

	def solve(self):
		for _ in range(int(input())):
			n = int(input())
			s = input()
			if '<' not in s or '>' not in s:
				print(0)
				continue
			last_left = n - 1 - s[::-1].index('<')
			first_right = s.index('>')
			print(min(n - 1 - last_left, first_right))
solver = BGoodString()
solver.solve()


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	s = input()
	l = 0
	for x in s:
		if x == '<':
			l += 1
		else:
			break
	r = 0
	s1 = reversed(s)
	for x in s1:
		if x == '>':
			r += 1
		else:
			break
	f = 10000000000.0
	if s[0] == '>' or s[n - 1] == '<':
		f = 0
	print(min(f, l, r))


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	if s[0] != '<' or s[n - 1] != '>':
		print(0)
	else:
		print(min(s.index('>'), n - ''.join(list(s)).rindex('<') - 1))


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	if s[0] == '>':
		print(0)
		continue
	if s[-1] == '<':
		print(0)
		continue
	st = 0
	e = n - 1
	for i in range(n):
		if s[i] == '>':
			st = i
			break
	for i in range(n - 1, -1, -1):
		if s[i] == '<':
			e = i
			break
	print(min(st, n - 1 - e))


def found():
	for i in range(n - 1):
		if thing[i] == '<' and thing[i + 1] == '>':
			problem = True
			problem_i = i
			break
		else:
			problem = False
			problem_i = i
	return (problem, problem_i)

def exe(x, y):
	if x == True and y == 0:
		if thing[n - 1] == '<':
			return 0
		else:
			return 1
	elif x == True and y == n - 2:
		if thing[0] == '>':
			return 0
		else:
			return 1
	elif x == True:
		if thing[0] == '>' and thing[n - 1] == '<':
			return 0
		else:
			return min(calc(y, '<'), calc(y, '>'))
	else:
		return 0

def calc(y, z):
	count = 0
	if z == '<':
		for i in range(y + 1):
			if thing[i] == '<':
				count += 1
			else:
				break
	elif z == '>':
		for i in range(n - 1, y - 1, -1):
			if thing[i] == '>':
				count += 1
			else:
				break
	return count
t = int(input())
for case in range(t):
	n = int(input())
	thing = input()
	if n == 1:
		ans = 0
	else:
		(a, b) = found()
		ans = exe(a, b)
	print(ans)


for _ in range(int(input())):
	n = int(input())
	s = input()
	if '>' in s and '<' in s:
		print(min(s.find('>'), n - 1 - s.rfind('<')))
	else:
		print(0)


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	if s[0] == '<' and s[n - 1] == '>':
		left = 0
		while s[left] == '<':
			left += 1
		s = s[::-1]
		right = 0
		while s[right] == '>':
			right += 1
		print(min(left, right))
	else:
		print(0)


n = int(input())
for i in range(n):
	(i, s) = (input(), input())
	count = 0
	if s[0] == '<' and s[-1] == '>':
		count = min(s.index('>'), s[::-1].index('<'))
	print(count)


n = int(input())
for _ in range(n):
	(_, s) = (input(), input())
	ans = 0
	if s[0] == '<' and s[-1] == '>':
		ans = min(s.index('>'), s[::-1].index('<'))
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	string = input()
	s = [string[i] for i in range(n)]
	if s[0] == '>':
		print(0)
	elif s[-1] == '<':
		print(0)
	else:
		ge = le = 0
		for i in range(n):
			if s[i] != '<':
				le = i
				break
		for i in range(n):
			if s[n - 1 - i] != '>':
				ge = i
				break
		print(min(le, ge))


import sys

def foo(s):
	r = 0
	m = 0
	for i in range(len(s)):
		if s[i] == '<':
			r += 1
		else:
			break
	for i in range(len(s) - 1, -1, -1):
		if s[i] == '>':
			m += 1
		else:
			break
	return min(r, m)
t = int(sys.stdin.readline().strip())
for _ in range(t):
	n = int(sys.stdin.readline().strip())
	s = list(sys.stdin.readline().strip())
	print(foo(s))


t = int(input())
for _ in range(t):
	n = int(input())
	a = input()
	c = 0
	d = 0
	if a[0] == '<' and a[-1] == '>':
		for i in range(1, n):
			if a[i] == '<':
				c += 1
			else:
				break
		for i in range(1, n):
			if a[n - 1 - i] == '>':
				d += 1
			else:
				break
		print(min(c, d) + 1)
	else:
		print(0)


t = int(input())
while t > 0:
	n = int(input())
	a = input()
	c = 0
	k = 0
	if a[0] == '>':
		print(0)
	elif a[n - 1] == '<':
		print(0)
	elif n == 1:
		print(0)
	else:
		for i in a:
			if i == '<':
				c += 1
			else:
				break
		for i in range(n - 1, -1, -1):
			if a[i] == '>':
				k += 1
			else:
				break
		if c > k:
			print(k)
		else:
			print(c)
	t -= 1


T = int(input())
for cas in range(0, T):
	n = int(input())
	s = input()
	s = list(s)
	if s[0] == '<' and s[n - 1] == '>':
		cnt1 = 0
		cnt2 = 0
		for i in range(0, n):
			if s[i] != '<':
				cnt1 = i
				break
		for i in range(n - 1, -1, -1):
			if s[i] != '>':
				cnt2 = n - i - 1
				break
		print(min(cnt1, cnt2))
	else:
		print('0')


tests = int(input())
for t in range(tests):
	length = int(input())
	string = input()
	right_pos = -1
	left_pos = -1
	for i in range(len(string)):
		if string[i] == '>':
			right_pos = i
			break
	for j in range(len(string) - 1, -1, -1):
		if string[j] == '<':
			left_pos = j
			break
	if left_pos == -1 or right_pos == -1:
		print(0)
		continue
	if left_pos == len(string) - 1 or right_pos == 0:
		print(0)
		continue
	if len(string) - left_pos > right_pos:
		print(right_pos)
		continue
	else:
		print(length - left_pos - 1)


t = int(input())
while t != 0:
	n = int(input())
	s = list(input())
	x = y = -1
	if '>' in s:
		x = s.index('>')
	if '<' in s:
		y = s[::-1].index('<')
	if x == -1 or y == -1:
		print(0)
	else:
		print(min(x, y))
	t -= 1


for _ in range(int(input())):
	n = int(input())
	string = input()
	cnt = 0
	for i in range(n // 2):
		if string[i] == '<' and string[n - 1 - i] == '>':
			cnt += 1
		else:
			break
	print(cnt)


for _ in ' ' * int(input()):
	n = int(input())
	s = input()
	if s[0] == '<' and s[-1] == '>':
		cnt1 = 0
		cnt2 = 0
		for i in s:
			if i == '<':
				cnt1 += 1
			else:
				break
		s = s[::-1]
		for i in s:
			if i == '>':
				cnt2 += 1
			else:
				break
		print(min(cnt1, cnt2))
	else:
		print(0)


t = int(input())
for i in range(t):
	n = input()
	s = input()
	try:
		x = s.index('>')
	except:
		x = 0
	try:
		y = s[::-1].index('<')
	except:
		y = 0
	z = min(x, y)
	print(z)


from collections import defaultdict as dd
import math

def nn():
	return int(input())

def li():
	return list(input())

def mi():
	return map(int, input().split())

def lm():
	return list(map(int, input().split()))
n = nn()
for i in range(n):
	l = nn()
	s = li()
	leftmin = 0
	rightmin = 0
	while leftmin < len(s) and s[leftmin] == '<':
		leftmin += 1
	while rightmin < len(s) and s[~rightmin] == '>':
		rightmin += 1
	print(min(leftmin, rightmin))


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		s = input()
		(left_count, right_count) = (0, 0)
		for i in range(n):
			if s[i] == '<':
				left_count += 1
			else:
				break
		for i in range(n - 1, -1, -1):
			if s[i] == '>':
				right_count += 1
			else:
				break
		print(min(left_count, right_count))
main()


for _ in range(int(input())):
	n = int(input())
	s = input()
	g = 0
	l = 0
	for i in range(n):
		if s[i] == '>':
			g = i
			break
	for i in range(n - 1, -1, -1):
		if s[i] == '<':
			break
		l += 1
	print(min(g, l))


from sys import stdin, stdout
from itertools import combinations
from collections import defaultdict
import math

def listIn():
	return list(map(int, stdin.readline().strip().split()))

def stringListIn():
	return [x for x in stdin.readline().split()]

def intIn():
	return int(stdin.readline())

def stringIn():
	return stdin.readline().strip()
t = intIn()
while t > 0:
	t -= 1
	n = intIn()
	s = stringIn()
	if s[0] == '<' and s[-1] == '>':
		(m1, m2) = (0, 0)
		for i in range(n):
			if s[i] == '<':
				m1 += 1
			else:
				break
		for i in range(n - 1, -1, -1):
			if s[i] == '>':
				m2 += 1
			else:
				break
		print(min(m1, m2))
	else:
		print(0)


n = int(input())
for i in range(n):
	x = int(input())
	s = input()
	if s[0] == '<' and s[x - 1] == '>':
		l = 0
		while s[l] == '<':
			l += 1
		r = 0
		while s[x - r - 1] == '>':
			r += 1
		print(min(l, r))
	else:
		print(0)


for i in range(int(input())):
	input()
	s = input()
	a = s.find('>')
	b = len(s) - 1 - s[::-1].find('<')
	print(max(0, min(a, len(s) - 1 - b)))


t = int(input())
while t != 0:
	t -= 1
	n = input()
	n = int(n)
	a = input()
	l = n - 1
	i = 0
	r = 0
	while i < n:
		if a[i] == '>':
			l = min(l, i)
		else:
			r = max(r, i)
		i += 1
	l = l + 1
	r = n - r
	print(min(l, r) - 1)


n = int(input())
for i in range(n):
	q = int(input())
	seq = list(input())
	st = 0
	for ch in seq:
		if ch == '<':
			st += 1
		else:
			break
	fin = 0
	seq.reverse()
	for ch in seq:
		if ch == '>':
			fin += 1
		else:
			break
	print(min(st, fin))


def get_ints():
	return list(map(int, stdin.readline().strip().split()))

def it():
	return int(input())
for _ in range(it()):
	n = it()
	s = list(input())
	flag = 0
	fla = 0
	(ans, ans2) = (0, 0)
	if len(set(s)) == 1:
		print(0)
	else:
		for i in range(n):
			if s[i] == '<' and flag == 0:
				ans += 1
			else:
				flag = 1
			if s[n - i - 1] == '>' and fla == 0:
				ans2 += 1
			else:
				fla = 1
		print(min(ans, ans2))


def func():
	n = int(input().rstrip())
	s = input().rstrip()
	left_count = 0
	right_count = 0
	ls = s
	rs = s[::-1]
	left_count = ls.find('>')
	right_count = rs.find('<')
	res = min(left_count, right_count)
	print(max(0, res))
t = int(input().rstrip())
for i in range(t):
	func()


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	if len(s) == 1:
		print(0)
	elif s[0] == '<' and s[-1] == '>':
		p = 0
		while p < n and s[p] == '<':
			p += 1
		q = 0
		while q < n and s[n - q - 1] == '>':
			q += 1
		print(min(n - 1, min(p, q)))
	else:
		print(0)


I = input
for _ in range(int(I())):
	(n, s) = (int(I()), I())
	print(max(0, min(s.find('>'), n - 1 - s.rfind('<'))))


import os
import sys
import math
import heapq
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
t = int(input())
while t > 0:
	n = int(input())
	s = input()
	val1 = 0
	val2 = 0
	i = 0
	while i < n:
		if s[i] == '>':
			val1 = i
			break
		i += 1
	i = n - 1
	while i >= 0:
		if s[i] == '<':
			val2 = n - 1 - i
			break
		i -= 1
	val = min(val1, val2)
	print(val)
	t -= 1


rep = int(input())
for i in range(rep):
	a = int(input())
	string = input()
	if string[0] == '<' and string[-1] == '>':
		mc = 0
		mf = 0
		for i in range(len(string)):
			if string[i] == '<':
				mc += 1
			else:
				break
		for i in range(len(string) - 1, -1, -1):
			if string[i] == '>':
				mf += 1
			else:
				break
		print(min(mc, mf))
	else:
		print(0)


for _ in range(int(input())):
	n = int(input())
	a = list(input())
	d = 0
	m = 0
	for i in range(n):
		if a[i] == '<':
			d = d + 1
		else:
			break
	for j in range(n - 1, -1, -1):
		if a[j] == '>':
			m = m + 1
		else:
			break
	print(min(m, d))


for _ in range(int(input())):
	n = int(input())
	s = input()
	a = b = 0
	for c in s:
		if c != '<':
			break
		a += 1
	for c in s[::-1]:
		if c != '>':
			break
		b += 1
	print(min(a, b))


T = int(input())
for i in range(0, T):
	n = int(input())
	s = input()
	ptr1 = 1000000000
	ptr2 = 1000000000
	for j in range(0, len(s)):
		if s[j] == '>':
			ptr1 = j
			break
	for j in range(len(s) - 1, -1, -1):
		if s[j] == '<':
			ptr2 = j
			break
	if ptr1 != 1000000000 and ptr2 != 1000000000:
		print(min(ptr1, n - ptr2 - 1))
	else:
		print(0)


ii = lambda : int(input())
mi = lambda : map(int, input().split())
li = lambda : list(mi())
for _ in range(ii()):
	n = ii()
	s = input().strip()
	c1 = c2 = 0
	for c in s:
		if c == '<':
			c1 += 1
		else:
			break
	for c in s[::-1]:
		if c == '>':
			c2 += 1
		else:
			break
	print(min(c1, c2))


test = int(input())
while test > 0:
	n = int(input())
	s = input()
	pos = 0
	ans = 0
	for i in range(n):
		if s[i] == '>' or s[n - i - 1] == '<':
			ans = i
			break
	print(ans)
	test -= 1


n = int(input())
while n:
	l = int(input())
	s = input()
	first = s.find('>')
	last = s.rfind('<')
	if first == -1 or last == -1:
		print(0)
	else:
		print(min(first, l - last - 1))
	n -= 1


for testis in range(int(input())):
	n = int(input())
	s = input()
	ss = s[::-1]
	a = 0
	b = 0
	while s[a] == '<' and a < n - 1:
		a = a + 1
	while ss[b] == '>' and b < n - 1:
		b = b + 1
	print(min(a, b))


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	countl = 0
	countr = 0
	for i in range(0, n):
		if s[i] == '<':
			countl += 1
		if s[n - i - 1] == '>':
			countr += 1
		if s[i] == '>' or s[n - i - 1] == '<':
			print(min(countl, countr))
			break
	else:
		print('0')


import sys
printn = lambda x: sys.stdout.write(x)
DBG = True

def ddprint(x):
	if DBG:
		print(x)
t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	if s[0] == '>' or s[n - 1] == '<':
		print(0)
	else:
		nl = 0
		while s[nl] == '<':
			nl += 1
		nr = 0
		while s[n - 1 - nr] == '>':
			nr += 1
		print(min(nl, nr))


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	if n == 1:
		print(0)
	else:
		ans1 = 0
		for j in range(n):
			if s[j] == '<':
				ans1 += 1
			else:
				break
		ans2 = 0
		for j in range(1, n + 1):
			if s[-j] == '>':
				ans2 += 1
			else:
				break
		print(min(ans1, ans2))


for _ in range(int(input())):
	n = int(input())
	st = list(input())
	if st[0] == '>':
		print(0)
	elif st[-1] == '<':
		print(0)
	else:
		(count1, count2) = (0, 0)
		for i in range(n):
			if st[i] == '<':
				count1 += 1
			else:
				break
		for i in range(n - 1, 0, -1):
			if st[i] == '>':
				count2 += 1
			else:
				break
		print(min(count1, count2))


t = int(input())
while t > 0:
	t -= 1
	ln = int(input())
	s = input()
	i = 0
	while i < ln and s[i] == '<':
		i += 1
	j = ln - 1
	while j >= 0 and s[j] == '>':
		j -= 1
	print(min(i, ln - j - 1))


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	if n == 1:
		print(0)
		continue
	if s[0] == '<' and s[-1] == '>':
		leftn = 0
		rightn = 0
		for j in range(n):
			if s[j] == '<':
				leftn += 1
			else:
				break
		for j in range(n - 1, -1, -1):
			if s[j] == '>':
				rightn += 1
			else:
				break
		print(min(leftn, rightn))
	else:
		print(0)


for _ in range(int(input())):
	n = int(input())
	s = input()
	if '>' not in s or '<' not in s:
		print(0)
	else:
		ans1 = s.index('>')
		s1 = s[::-1]
		ans2 = s1.index('<')
		ans = min(ans1, ans2)
		print(ans)


for a0 in range(int(input())):
	n = int(input())
	str = input()
	x = 0
	y = 0
	for i in range(n):
		if str[i] == '>':
			x = i
			break
	str = str[::-1]
	for i in range(n):
		if str[i] == '<':
			y = i
			break
	print(min(x, y))


t = int(input())
while t:
	t -= 1
	n = int(input())
	s = input()
	s1 = list(s)
	if len(set(s1)) == 1:
		print('0')
		continue
	ans1 = 0
	ans2 = 0
	for i in range(n):
		if s[i] == '<':
			ans1 += 1
		else:
			break
	for i in range(n - 1, -1, -1):
		if s[i] == '>':
			ans2 += 1
		else:
			break
	print(min(ans1, ans2))


import re
t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	if s[0] == '<' and s[-1] == '>':
		m = re.match('(<+).*?(>+)$', s)
		print(min(map(len, m.groups())))
	else:
		print(0)


from math import inf
t = int(input())
a = list()
for j in range(t):
	n = int(input())
	s = input()
	result = inf
	for i in range(n):
		if s[i] == '>':
			result = min(result, i)
		else:
			result = min(result, n - i - 1)
	a.append(result)
print(*a, sep='\n')


n = int(input())
for i in range(n):
	x = int(input())
	s = input()
	ft = 0
	sd = 0
	for i in range(x):
		if s[i] == '>':
			ft = i
			break
	for i in range(x - 1, -1, -1):
		if s[i] == '<':
			sd = x - i - 1
			break
	print(min(ft, sd))


t = int(input())
for _ in range(t):
	input()
	s = input()
	pref_len = 0
	for c in s:
		if c != '<':
			break
		pref_len += 1
	suf_len = 0
	for c in reversed(s):
		if c != '>':
			break
		suf_len += 1
	print(min(suf_len, pref_len))


n = int(input())
for _ in range(n):
	input()
	s = input()
	k = len(s)
	(l, r) = (0, k - 1)
	(cr, cl) = (0, 0)
	while l < k and s[l] == '<':
		l = l + 1
		cl = cl + 1
	while r >= 0 and s[r] == '>':
		r = r - 1
		cr = cr + 1
	if cl == k or cr == k:
		print(0)
	else:
		print(min(cl, cr))


n = int(input())
for x in range(n):
	input()
	sf = input()
	sr = sf[::-1]
	i = 0
	while i < len(sf) and sf[i] == '<':
		i += 1
	j = 0
	while j < len(sr) and sr[j] == '>':
		j += 1
	print(min(i, j))


for _ in range(int(input())):
	n = int(input())
	s = input().strip()
	ans = 0
	i = 0
	while i < n and s[i] == '<':
		ans += 1
		i += 1
	ans1 = 0
	i = n - 1
	while i > -1 and s[i] == '>':
		ans1 += 1
		i -= 1
	print(min(ans, ans1))


import atexit
import io
import sys
_I_B = sys.stdin.read().splitlines()
input = iter(_I_B).__next__
_O_B = io.StringIO()
sys.stdout = _O_B

@atexit.register
def write():
	sys.__stdout__.write(_O_B.getvalue())
for _ in range(int(input())):
	n = int(input())
	s = input()
	if s[0] == '<' and s[-1] == '>':
		co1 = co2 = 0
		for i in range(n):
			if s[i] == '<':
				co1 += 1
			else:
				break
		for i in range(1, n + 1):
			if s[-i] == '>':
				co2 += 1
			else:
				break
		print(min(co1, co2))
	else:
		print(0)


t = int(input())
for i in range(t):
	answer = 0
	n = int(input())
	s = list(input())
	if s[0] == '<' and s[-1] == '>':
		c = 0
		b = 0
		for l in range(len(s) - 1):
			if s[l] == s[l + 1]:
				b += 1
			else:
				break
		for z in range(1, len(s)):
			if s[-z] == s[-z - 1]:
				c += 1
			else:
				break
		print(min(c, b) + 1)
	else:
		for k in range(1, len(s)):
			if len(set(s[0:k])) == 1 and s[0:k][0] == '<' and (len(set(s[k:len(s)])) == 1) and (s[k:len(s)][0] == '>'):
				answer = min(len(s[0:k]), len(s[k:len(s)]))
		print(answer)


for t in range(int(input())):
	n = int(input())
	wo = input().strip()
	(ii, jj) = (0, 0)
	(i, j) = (0, n - 1)
	while i < n and wo[i] == '<':
		ii += 1
		i += 1
	while j >= 0 and wo[j] == '>':
		j -= 1
		jj += 1
	print(min(ii, jj))


for _ in range(int(input())):
	input()
	s = input()
	b1 = b2 = 0
	b = True
	for c in s:
		if b and c == '<':
			b1 += 1
		else:
			b = False
		if c == '>':
			b2 += 1
		else:
			b2 = 0
	print(min(b1, b2))


t = int(input())
for k in range(t):
	cnt1 = cnt2 = 0
	j = int(input())
	n = list(input())
	for item in n:
		if item == '<':
			cnt1 += 1
		else:
			break
	n.reverse()
	for item in n:
		if item == '>':
			cnt2 += 1
		else:
			break
	print(min(cnt1, cnt2))


for _ in range(int(input())):
	n = int(input())
	s = list(input())
	a = b = -1
	if '>' in s:
		a = s.index('>')
	if '<' in s:
		b = s[::-1].index('<')
	if a == -1 or b == -1:
		print(0)
	else:
		print(min(a, b))


n = int(input())
for i in range(n):
	l = int(input())
	s = input()
	ibegin = s.find('>')
	iend = s[::-1].find('<')
	if ibegin > 0 and iend > 0:
		print(min(ibegin, iend))
	else:
		print(0)


t = int(input())
for i in range(0, t):
	n = int(input())
	c1 = 0
	c2 = 0
	s = input()
	L = list(s)
	if L[0] == '>' and L[n - 1] == '>':
		print('0')
		continue
	elif L[0] == '<' and L[n - 1] == '<':
		print('0')
		continue
	elif L[0] == '>' and L[n - 1] == '<':
		print('0')
		continue
	else:
		for j in range(0, n):
			if L[j] == '<':
				c1 += 1
			else:
				break
			if L[n - 1 - j] == '>':
				c2 += 1
			else:
				break
	if c1 < c2:
		print(c1)
	else:
		print(c2)


t = int(input())
tests = []
for i in range(t):
	length = int(input())
	tests.append(input())

def solve(s):
	streak1 = 0
	streak2 = 0
	for i in range(len(s)):
		if s[i] == '<':
			streak1 += 1
		else:
			break
	for i in range(len(s)):
		if s[-i - 1] == '>':
			streak2 += 1
		else:
			break
	return min(streak1, streak2)
res = list(map(lambda x: str(solve(x)), tests))
print('\n'.join(res))


Q = int(input())
test = 0
while test < Q:
	N = int(input())
	s = input()
	res1 = 0
	for i in range(N):
		if s[i] == '<':
			res1 += 1
		else:
			break
	res2 = 0
	for i in range(N - 1, -1, -1):
		if s[i] == '>':
			res2 += 1
		else:
			break
	print(min(res1, res2))
	test += 1


t = int(input())
out = []
for i in range(t):
	n = int(input())
	n = n - 1
	s = input()
	if s.count('>') == 0 or s.count('<') == 0 or n == 0:
		out.append(0)
	elif s.find('>') == 0 or n - s.rfind('<') == 0:
		out.append(0)
	elif s.find('>') <= n - s.rfind('<'):
		out.append(s.find('>'))
	else:
		out.append(n - s.rfind('<'))
for i in range(t):
	print(out[i])


for i in range(int(input())):
	n = int(input())
	a = input()
	(b, c) = (0, 0)
	for j in range(n):
		if a[j] == '<':
			b += 1
		else:
			break
	for j in range(n - 1, -1, -1):
		if a[j] == '>':
			c += 1
		else:
			break
	print(min(b, c))


n = int(input())
gag = []
for i in range(n):
	(num1, num2) = (0, 0)
	num_elm = int(input())
	zerostr = input()
	for j in range(num_elm // 2):
		if zerostr[j] == '<':
			num1 += 1
		else:
			break
	for j in range(num_elm // 2):
		if zerostr[-1 - j] == '>':
			num2 += 1
		else:
			break
	gag.append(min(num1, num2))
for i in gag:
	print(i)


n = int(input())
for i in range(n):
	k = int(input())
	s = input()
	l = -1
	r = -1
	for j in range(k):
		if s[j] == '>' and r == -1:
			r = j
		elif s[j] == '<':
			l = j
	if l == -1 or r == -1 or s[0] == '>' or (s[-1] == '<'):
		print(0)
	else:
		print(min(k - l - 1, r))


for _ in range(int(input())):
	n = int(input())
	s = input()
	s1 = 0
	s2 = 0
	for i in s:
		if i == '<':
			s1 += 1
		else:
			break
	for i in s[::-1]:
		if i == '>':
			s2 += 1
		else:
			break
	print(min(s1, s2))


test_count = int(input())
for _ in range(test_count):
	n = int(input())
	s = input()
	a = max(s.find('>'), 0)
	b = max(s[::-1].find('<'), 0)
	print(min(a, b))


def solve():
	n = int(input())
	s = input()
	if s.count('<') == 0:
		return 0
	if s.count('>') == 0:
		return 0
	if s[0] == '>':
		return 0
	if s[-1] == '<':
		return 0
	s1 = 0
	s2 = 0
	for i in range(n):
		if s[i] == '<':
			s1 += 1
		else:
			break
	for i in range(n - 1, -1, -1):
		if s[i] == '>':
			s2 += 1
		else:
			break
	return min(s1, s2)
t = int(input())
for i in range(t):
	print(solve())


n = int(input())
for i in range(n):
	m = int(input())
	s = input()
	num1 = 0
	num2 = 0
	j1 = 0
	j2 = m - 1
	while j1 < m and s[j1] == '<':
		num1 += 1
		j1 += 1
	while j2 >= 0 and s[j2] == '>':
		num2 += 1
		j2 -= 1
	print(min(num1, num2))


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	ans = n
	for i in range(n):
		if s[i] == '<':
			ans = min(ans, n - i - 1)
		else:
			ans = min(ans, i)
	print(ans)


n = int(input())
for _ in range(n):
	m = int(input())
	st = input()
	kleft = 0
	while kleft < len(st) and st[kleft] == '<':
		kleft += 1
	kright = 0
	while kright < len(st) and st[len(st) - kright - 1] == '>':
		kright += 1
	print(min(kleft, kright))


k = int(input())
for i in range(k):
	n = int(input())
	s = input()
	if s[0] == s[-1] or (s[0] == '>' and s[-1] == '<') or s.count('<') in [0, n]:
		print(0)
		continue
	count1 = s.index('>')
	count2 = s[::-1].index('<')
	print(min(count1, count2))


import collections, atexit, math, sys, bisect
sys.setrecursionlimit(1000000)
isdebug = False
try:
	import pylint
	import numpy

	def dprint(*args, **kwargs):
		print(*args, file=sys.stderr)
	dprint('debug mode')
	isdebug = True
except Exception:

	def dprint(*args, **kwargs):
		pass

def red_inout():
	inId = 0
	outId = 0
	if not isdebug:
		inId = 0
		outId = 0
	if inId > 0:
		dprint('use input', inId)
		try:
			f = open('input' + str(inId) + '.txt', 'r')
			sys.stdin = f
		except Exception:
			dprint('invalid input file')
	if outId > 0:
		dprint('use output', outId)
		try:
			f = open('stdout' + str(outId) + '.txt', 'w')
			sys.stdout = f
		except Exception:
			dprint('invalid output file')
		atexit.register(lambda : sys.stdout.close())
if isdebug and len(sys.argv) == 1:
	red_inout()

def getIntList():
	return list(map(int, input().split()))

def solve():
	pass
T_ = 1
(T_,) = getIntList()
for iii_ in range(T_):
	(N,) = getIntList()
	s = input()
	r = 0
	for i in range(N):
		if s[i] == '>':
			r = i
			break
	r1 = 0
	for i in range(N - 1, -1, -1):
		if s[i] == '<':
			r1 = N - 1 - i
			break
	print(min(r, r1))


t = int(input())
for operation in range(t):
	n = int(input())
	L = [i for i in input()]
	s = 0
	for i in range(n // 2):
		if L[i] == '<' and L[n - 1 - i] == '>':
			s += 1
		else:
			break
	print(s)


import collections
for t in range(int(input())):
	n = int(input())
	s = input()
	(l, r) = (0, 0)
	if s[0] == '<':
		for i in range(1, n):
			if s[i] != s[i - 1]:
				l = i
				break
	if s[-1] == '>':
		for i in range(n - 2, -1, -1):
			if s[i] != s[i + 1]:
				r = n - i - 1
				break
	print(min(l, r))


t = int(input())
l = 0
r = 0
for i in range(t):
	n = int(input())
	s = input()
	if s[0] == '<' and s[len(s) - 1] == '>':
		for j in range(len(s)):
			if s[j] == '<':
				l += 1
			else:
				break
		for j in range(len(s) - 1, -1, -1):
			if s[j] == '>':
				r += 1
			else:
				break
	print(min(l, r))
	l = 0
	r = 0


for _ in range(int(input())):
	(n, s) = (input(), input())
	left = s.find('>')
	if left in [-1, 0]:
		print(0)
	else:
		right = s[::-1].find('<')
		print(0 if right in [-1, 0] else min(left, right))


cases = int(input())
for _ in range(cases):
	len = int(input())
	s = input()
	print(max(0, min(s.find('>'), s[::-1].find('<'))))


n = int(input())
for i in range(0, n):
	o = int(input())
	p = input().rstrip()
	x = list(p)
	if '>' not in x or '<' not in x:
		print(0)
	else:
		C = list(x)
		C.reverse()
		T = x.index('>')
		F = C.index('<')
		if T == 0 or F == 0:
			print(0)
		else:
			A = x[0:T]
			B = C[0:F]
			d = A.count('<')
			e = B.count('>')
			print(min(d, e))


import sys

def rint():
	return map(int, sys.stdin.readline().split())
t = int(input())
for _ in range(t):
	cand = 0
	n = int(input())
	s = input()
	for i in range(n):
		if s[i] == '>':
			cand = i
			break
		if s[n - i - 1] == '<':
			cand = i
			break
	print(cand)


cin = input
t = int(cin())
while t > 0:
	n = int(cin())
	s = input()
	(i, j) = (-1, n)
	while i < n - 1 and s[i + 1] == '<':
		i += 1
	while j > 0 and s[j - 1] == '>':
		j -= 1
	print(min(i + 1, n - j))
	t -= 1


t = int(input())
for turn in range(t):
	n = int(input())
	s = input()
	if s[0] == '<' and s[n - 1] == '>':
		left_del = 0
		right_del = 0
		while s[left_del] == '<':
			left_del += 1
		while s[n - right_del - 1] == '>':
			right_del += 1
		print(min(left_del, right_del))
	else:
		print(0)


import math
t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	first = 0
	second = 0
	for i in range(n):
		if s[i] == '>':
			first = i
			break
	for i in range(n - 1, -1, -1):
		if s[i] == '<':
			second = n - i - 1
			break
	print(min(first, second))


import sys
import copy
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	S = input().rstrip()
	(left, right) = (0, 0)
	for c in S:
		if c == '<':
			left += 1
		else:
			break
	for c in reversed(S):
		if c == '>':
			right += 1
		else:
			break
	print(min(left, right))


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	if s[0] == '>' or s[-1] == '<':
		print(0)
		continue
	l = 0
	r = n - 1
	lCount = 0
	rCount = 0
	while s[l] == '<' and l < n:
		lCount += 1
		l += 1
	while s[r] == '>' and -1 < r:
		rCount += 1
		r -= 1
	print(min(lCount, rCount))


for i in range(int(input())):
	n = int(input())
	s = [i for i in input()]
	a = 10 ** 9
	b = 0
	for i in range(n):
		if s[i] == '>':
			a = min(a, i)
		else:
			b = i
	print(min(a, n - b - 1))


import sys
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
t = int(input())
while t != 0:
	t -= 1
	n = int(input())
	s = input()
	ans = 0
	min1 = 0
	min2 = 0
	for c in s:
		if c != '<':
			break
		min1 += 1
	for c in s[::-1]:
		if c != '>':
			break
		min2 += 1
	ans = min(min1, min2)
	print(ans)


for _ in range(int(input())):
	input()
	s = input()
	c1 = c2 = 0
	for i in s:
		if i == '<':
			c1 += 1
		else:
			break
	for i in s[::-1]:
		if i == '>':
			c2 += 1
		else:
			break
	print(min(c1, c2))


intin = lambda : map(int, input().split())
Ain = lambda : list(map(int, input().split()))
N = int(input())
while N > 0:
	N -= 1
	n = int(input())
	s = input()
	l = len(s)
	lft = 0
	rt = l - 1
	for i in range(l):
		if s[i] == '>':
			lft = i
			break
	for i in range(l):
		j = l - i - 1
		if s[j] == '<':
			rt = i
			break
	print(min(rt, lft))


t = int(input())
for i in range(t):
	n = int(input())
	l = list(input())
	if '>' not in l:
		a = 0
	else:
		a = l.index('>')
	l.reverse()
	if '<' not in l:
		b = 0
	else:
		b = l.index('<')
	print(min(a, b))


t = int(input())
for i in range(t):
	cnt = 0
	n = int(input())
	s = input()
	if s[0] == '<' and s[-1] == '>':
		left = 0
		right = 0
		for j in range(n):
			if s[j] == '<':
				left += 1
			else:
				break
		for j in range(n - 1, -1, -1):
			if s[j] == '>':
				right += 1
			else:
				break
		cnt = min(left, right)
	print(cnt)


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	left = right = 0
	if s[0] == '<' and s[-1] == '>':
		left = s.index('>')
		right = s[::-1].index('<')
	print(min(left, right))


t = int(input())
for _ in range(t):
	input()
	s = input().strip()
	l = s.find('>')
	if l == -1:
		l = 101
	r = s.rfind('<')
	if r == -1:
		r = 101
	ans = min(l, max(len(s) - r - 1, 0))
	print(ans)


cases = int(input())
for t in range(cases):
	n = int(input())
	s = input()
	if s.find('>') == -1 or s.find('<') == -1:
		print(0)
	else:
		print(min(s.find('>'), n - s.rfind('<') - 1))


tsize = int(input())

def solve(slen, string):
	if string[0] == '>' or string[-1] == '<':
		return 0
	ls = 0
	for c in string:
		if c == '<':
			ls += 1
		else:
			break
	rs = 0
	for c in reversed(string):
		if c == '>':
			rs += 1
		else:
			break
	return min(ls, rs)
for _ in range(0, tsize):
	slen = int(input())
	string = input()
	print(solve(slen, string))


t = int(input())
while t:
	n = int(input())
	s = input()
	ind = -1
	lnd = -1
	for i in range(len(s)):
		if s[i] == '>' and ind == -1:
			ind = i
			break
	for i in range(len(s) - 1, -1, -1):
		if s[i] == '<' and lnd == -1:
			lnd = i
	if ind == 0 or lnd == n - 1 or lnd == -1 or (ind == -1):
		print(0)
	else:
		print(min(ind, n - lnd - 1))
	t -= 1


def get_good_count(n, s):
	if s[0] == '>' or s[-1] == '<':
		return 0
	c = 0
	l = 0
	while s[l] == '<':
		l += 1
	r = n - 1
	while s[r] == '>':
		r -= 1
	return min(l, n - r - 1)
for _ in range(int(input())):
	n = int(input())
	s = input()
	print(get_good_count(n, s))