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
Tags: String algorithms

Implementation

Starter code:

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


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))


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


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)))


t = int(input())
while t:
	n = int(input())
	s = input()
	a = s[::-1]
	if n == 1:
		print('0')
	elif s.count('<') == n or s.count('>') == n:
		print('0')
	elif s.index('>') == 0 or s.index('<') == n - 1:
		print('0')
	else:
		print(min(a.index('<'), s.index('>')))
	t -= 1


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()


t = int(input())
for i in range(t):
	a = int(input())
	b = input()
	z = a - 1
	for j in range(a):
		if b[j] == '>' or b[a - j - 1] == '<':
			z = min(z, j)
	print(z)


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)


Q = int(input())
for i in range(Q):
	n = int(input())
	s = input()
	ANS = ANS2 = 1000
	if '>' in s:
		ANS = s.index('>')
	if '<' in s:
		ANS2 = n - 1 - s.rindex('<')
	print(min(ANS, ANS2))


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


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))


for _ in [0] * int(input()):
	n = int(input())
	s = input()
	print(min(s.find('>') % n, n - 1 - s.rfind('<')))


a = int(input())
for i in range(a):
	b = int(input())
	st = input()
	frst = 0
	lst = 0
	if st[0] == '>' or st[-1] == '<':
		print(0)
	else:
		while st[frst] != '>':
			frst += 1
		while st[-1 - lst] != '<':
			lst += 1
		print(min(frst, lst))


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


n = int(input())
for i in range(n):
	m = int(input())
	string = input().strip()
	(leftleft, rightright) = (0, 0)
	if string[0] == '>' or string[-1] == '<':
		print(0)
	else:
		print(min(string.find('>'), len(string) - 1 - string.rfind('<')))


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)


import math
import bisect
import itertools
import sys
I = lambda : sys.stdin.readline()
mod = 10 ** 9 + 7

def modu(a, m):
	if a % m:
		return a % m
	return m

def mindiff(a):
	b = a[:]
	b.sort()
	m = 10000000000
	for i in range(len(b) - 1):
		if b[i + 1] - b[i] < m:
			m = b[i + 1] - b[i]
	return m

def lcm(a, b):
	return a * b // math.gcd(a, b)

def merge(a, b):
	i = 0
	j = 0
	c = 0
	ans = []
	while i < len(a) and j < len(b):
		if a[i] < b[j]:
			ans.append(a[i])
			i += 1
		else:
			ans.append(b[j])
			c += len(a) - i
			j += 1
	ans += a[i:]
	ans += b[j:]
	return (ans, c)

def mergesort(a):
	if len(a) == 1:
		return (a, 0)
	mid = len(a) // 2
	(left, left_inversion) = mergesort(a[:mid])
	(right, right_inversion) = mergesort(a[mid:])
	(m, c) = merge(left, right)
	c += left_inversion + right_inversion
	return (m, c)

def is_prime(num):
	if num == 1:
		return False
	if num == 2:
		return True
	if num == 3:
		return True
	if num % 2 == 0:
		return False
	if num % 3 == 0:
		return False
	t = 5
	a = 2
	while t <= int(math.sqrt(num)):
		if num % t == 0:
			return False
		t += a
		a = 6 - a
	return True

def ceil(a, b):
	if a % b == 0:
		return a // b
	else:
		return a // b + 1

def ncr1(n, r):
	s = 1
	for i in range(min(n - r, r)):
		s *= n - i
		s %= mod
		s *= pow(i + 1, mod - 2, mod)
		s %= mod
	return s
for _ in range(int(input())):
	n = int(input())
	s = input()
	f = 0
	t = 0
	for i in range(n):
		if s[i] == '>':
			t = 1
			break
	for j in range(n - 1, -1, -1):
		if s[j] == '<':
			f = 1
			break
	if s == '>' * n or s == '<' * n:
		print(0)
	else:
		i = i
		j = n - 1 - j
		print(min(i, j))


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')


n = int(input())
for i in range(n):
	nn = int(input())
	s = input()
	nomr = nn - 1
	noml = nn - 1
	(left, right, j) = ('', '', 0)
	while j != nn or (left != '<' and right != '>'):
		if s[j] == '>' and right == '':
			right = '>'
			nomr = j
		if s[-1 - j] == '<' and left == '':
			left = '<'
			noml = j
		j += 1
	print(min(noml, nomr))


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)


for i in range(int(input())):
	n = int(input())
	s = input()
	l = len(s)
	res = -float('inf')
	for i in range(l):
		if s[i] == '>':
			res = max(res, l - i)
	for i in range(l - 1, -1, -1):
		if s[i] == '<':
			res = max(res, i + 1)
	print(l - res)


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)


from sys import stdin, stdout
import cProfile, math
from collections import Counter, defaultdict
from bisect import bisect_left, bisect, bisect_right
import itertools
from copy import deepcopy
from fractions import Fraction
import sys, threading
import operator as op
from functools import reduce
sys.setrecursionlimit(10 ** 6)
threading.stack_size(2 ** 27)
fac_warmup = False
printHeap = str()
memory_constrained = False
P = 10 ** 9 + 7
import sys

class merge_find:

	def __init__(self, n):
		self.parent = list(range(n))
		self.size = [1] * n
		self.num_sets = n
		self.lista = [[_] for _ in range(n)]

	def find(self, a):
		to_update = []
		while a != self.parent[a]:
			to_update.append(a)
			a = self.parent[a]
		for b in to_update:
			self.parent[b] = a
		return self.parent[a]

	def merge(self, a, b):
		a = self.find(a)
		b = self.find(b)
		if a == b:
			return
		if self.size[a] < self.size[b]:
			(a, b) = (b, a)
		self.num_sets -= 1
		self.parent[b] = a
		self.size[a] += self.size[b]
		self.lista[a] += self.lista[b]

	def set_size(self, a):
		return self.size[self.find(a)]

	def __len__(self):
		return self.num_sets

def display(string_to_print):
	stdout.write(str(string_to_print) + '\n')

def primeFactors(n):
	factors = dict()
	for i in range(2, math.ceil(math.sqrt(n)) + 1):
		while n % i == 0:
			if i in factors:
				factors[i] += 1
			else:
				factors[i] = 1
			n = n // i
	if n > 2:
		factors[n] = 1
	return factors

def fibonacci_modP(n, MOD):
	if n < 2:
		return 1
	return (cached_fn(fibonacci_modP, (n + 1) // 2, MOD) * cached_fn(fibonacci_modP, n // 2, MOD) + cached_fn(fibonacci_modP, (n - 1) // 2, MOD) * cached_fn(fibonacci_modP, (n - 2) // 2, MOD)) % MOD

def factorial_modP_Wilson(n, p):
	if p <= n:
		return 0
	res = p - 1
	for i in range(n + 1, p):
		res = res * cached_fn(InverseEuler, i, p) % p
	return res

def binary(n, digits=20):
	b = bin(n)[2:]
	b = '0' * (20 - len(b)) + b
	return b

def isprime(n):
	if n < 4:
		return True
	if n % 2 == 0:
		return False
	if n % 3 == 0:
		return False
	i = 5
	w = 2
	while i * i <= n:
		if n % i == 0:
			return False
		i += w
		w = 6 - w
	return True
factorial_modP = []

def warm_up_fac(MOD):
	global factorial_modP, fac_warmup
	if fac_warmup:
		return
	factorial_modP = [1 for _ in range(fac_warmup_size + 1)]
	for i in range(2, fac_warmup_size):
		factorial_modP[i] = factorial_modP[i - 1] * i % MOD
	fac_warmup = True

def InverseEuler(n, MOD):
	return pow(n, MOD - 2, MOD)

def nCr(n, r, MOD):
	global fac_warmup, factorial_modP
	if not fac_warmup:
		warm_up_fac(MOD)
		fac_warmup = True
	return factorial_modP[n] * (pow(factorial_modP[r], MOD - 2, MOD) * pow(factorial_modP[n - r], MOD - 2, MOD) % MOD) % MOD

def test_print(*args):
	if testingMode:
		print(args)

def display_list(list1, sep=' '):
	stdout.write(sep.join(map(str, list1)) + '\n')

def display_2D_list(li):
	for i in li:
		print(i)

def prefix_sum(li):
	sm = 0
	res = []
	for i in li:
		sm += i
		res.append(sm)
	return res

def get_int():
	return int(stdin.readline().strip())

def get_tuple():
	return map(int, stdin.readline().split())

def get_list():
	return list(map(int, stdin.readline().split()))
import heapq, itertools
pq = []
entry_finder = {}
REMOVED = '<removed-task>'

def add_task(task, priority=0):
	if task in entry_finder:
		remove_task(task)
	count = next(counter)
	entry = [priority, count, task]
	entry_finder[task] = entry
	heapq.heappush(pq, entry)

def remove_task(task):
	entry = entry_finder.pop(task)
	entry[-1] = REMOVED

def pop_task():
	while pq:
		(priority, count, task) = heapq.heappop(pq)
		if task is not REMOVED:
			del entry_finder[task]
			return task
	raise KeyError('pop from an empty priority queue')
memory = dict()

def clear_cache():
	global memory
	memory = dict()

def cached_fn(fn, *args):
	global memory
	if args in memory:
		return memory[args]
	else:
		result = fn(*args)
		memory[args] = result
		return result

def ncr(n, r):
	return math.factorial(n) / (math.factorial(n - r) * math.factorial(r))

def binary_serach(i, li):
	fn = lambda x: li[x] - x // i
	x = -1
	b = len(li)
	while b >= 1:
		while b + x < len(li) and fn(b + x) > 0:
			x += b
		b = b // 2
	return x
TestCases = True
testingMode = False
fac_warmup_size = 10 ** 5 + 100
optimiseForReccursion = True
from math import factorial

def main():
	n = get_int()
	st = input()
	res = 10000000000000000000000000000000000
	for (i, ele) in enumerate(st):
		if ele == '>':
			res = i
			break
	for (i, ele) in enumerate(reversed(st)):
		if ele == '<':
			res = min(i, res)
			break
	print(res)
if TestCases:
	for _ in range(get_int()):
		cProfile.run('main()') if testingMode else main()
else:
	(cProfile.run('main()') if testingMode else main()) if not optimiseForReccursion else threading.Thread(target=main).start()


import sys, collections, math, itertools, random, bisect
INF = sys.maxsize

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

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

def input():
	return sys.stdin.readline().strip()
mod = 1000000007
for _ in range(int(input())):
	n = int(input())
	s = input()
	print(min(n - len(s.lstrip('<')), n - len(s.rstrip('>'))))


def fastio():
	import sys
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
(t,) = I()
while t:
	t -= 1
	(n,) = I()
	l = [0]
	s = input()
	if s[0] == '>' or s[-1] == '<':
		print(0)
	else:
		m = s[::-1]
		i = n - 1
		while s[i] != '<':
			i -= 1
		print(min(n - i - 1, s.index('>')))


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]))


for _ in range(int(input())):
	(n, s) = (int(input()), input())
	(a1, a2) = (0, 0)
	for ch in s:
		if ch == '>':
			break
		else:
			a1 += 1
	for ch in reversed(s):
		if ch == '<':
			break
		else:
			a2 += 1
	print(min(a1, a2))


tests = int(input())
for _ in range(tests):
	n = int(input())
	s = input()
	ans = n - 1
	left = s.find('>')
	if left != -1:
		ans = min(ans, left)
	right = s.rfind('<')
	if right != -1:
		ans = min(ans, n - right - 1)
	print(ans)


t = int(input())
for i in range(t):
	t = 0
	n = int(input())
	s = input()
	m = 0
	for k in range(n):
		if s[k] == '<':
			c = 0
			for j in range(k):
				c += 1
			m = max(c, m)
		elif s[k] == '>':
			c = 0
			for j in range(k + 1, len(s)):
				c += 1
			m = max(c, m)
	print(n - 1 - m)


t = int(input())
a = [None] * t
for i in range(0, t):
	n = int(input())
	L = input()
	r = None
	l = None
	for j in range(0, n):
		if L[j] == '>':
			r = j
			break
	for j in range(n - 1, -1, -1):
		if L[j] == '<':
			l = j
			break
	if r == 0 or l == n - 1:
		a[i] = 0
	elif r < l:
		a[i] = min(r, n - l - 1)
	elif r > l:
		a[i] = min(n - r, l + 1)
for i in range(0, t):
	print(a[i])


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


test_cases = int(input())
operations = []
for i in range(test_cases):
	input()
	operations.append(input())
for operation in operations:
	left = 0
	right = 0
	if operation[0] == '>' or operation[-1] == '<':
		print('0')
	else:
		for character in operation:
			if character != '>':
				left += 1
			else:
				break
		for i in range(len(operation) - 1, -1, -1):
			if operation[i] != '<':
				right += 1
			else:
				break
		print(min(left, right))


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))


t = int(input())
while t > 0:
	n = int(input())
	s = input()
	ans = n - 1
	for (i, c) in enumerate(s):
		if c == '>' or s[n - 1 - i] == '<':
			ans = min(ans, i)
	print(ans)
	t -= 1


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))


digl = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
mod = 10 ** 9 + 7
t = ii()
for _ in range(t):
	n = ii()
	s = si()
	x1 = x2 = 0
	if '>' in s:
		x1 = s.index('>')
	if '<' in s:
		x2 = s.rindex('<')
	print(min(x1, n - x2 - 1))


for _ in range(int(input())):
	n = int(input())
	a = input()
	print(min(a.find('>') % n, n - 1 - a.rfind('<')))


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)


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	ans = 0
	while True:
		if s[0] == '>' or s[-1] == '<':
			break
		elif len(set(list(s[1:]))) == 1:
			ans += 1
			break
		elif len(set(list(s[:-1]))) == 1:
			ans += 1
			break
		else:
			s = s[1:-1]
			ans += 1
	print(ans)


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))


def to_delete(s, n):
	l_counter = 0
	while l_counter < n and s[l_counter] != '>':
		l_counter += 1
	r_counter = 0
	while r_counter < n and s[n - 1 - r_counter] != '<':
		r_counter += 1
	return min(l_counter, r_counter)
t = int(input())
tests = []
for i in range(t):
	n = int(input())
	s = input()
	tests.append((s, n))
for i in range(t):
	print(to_delete(tests[i][0], tests[i][1]))


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 check(n, signs):
	try:
		max1 = signs.index('>')
	except:
		max1 = 101
	signs.reverse()
	try:
		max2 = signs.index('<')
	except:
		max2 = 101
	ai = min(max1, max2)
	return ai
t = int(input())
answer = []
for i in range(t):
	n = int(input())
	enter = input()
	signs = list(enter)
	ai = check(n, signs)
	answer.append(ai)
for i in range(len(answer)):
	print(answer[i])


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


gi = lambda : list(map(int, input().strip().split()))
for k in range(gi()[0]):
	gi()
	s = input()
	if '>' not in s:
		print(s[::-1].index('<'))
	elif '<' not in s:
		print(s.index('>'))
	else:
		print(min(s.index('>'), s[::-1].index('<')))


def main():
	n = int(input())
	string = str(input())
	index = n + 1
	for i in range(n):
		if string[i] == '>' or string[n - 1 - i] == '<':
			index = min(index, i)
			break
	print(index)
	return

def test():
	t = int(input())
	while t:
		main()
		t -= 1
test()


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)


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


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))


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


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))


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


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)


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


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	if len(s) == 1:
		print('0')
	elif len(s) == 2:
		if s[0] == '<' and s[1] == '>':
			print('1')
		else:
			print('0')
	elif s[0] == '>' or s[n - 1] == '<':
		print('0')
	else:
		start = s.index('>')
		end = s[::-1].index('<')
		if start < end:
			print(start)
		else:
			print(end)


import sys

def solve(s, n):
	l = 0
	r = n - 1
	while l < n:
		if s[l] == '>':
			return l
		if s[r] == '<':
			return n - r - 1
		l += 1
		r -= 1
	return n - 1

def main():
	t = int(sys.stdin.readline().strip())
	for _ in range(t):
		n = int(sys.stdin.readline().strip())
		s = sys.stdin.readline().strip()
		print(solve(s, n))
main()


n = int(input())
for j in range(n):
	an = int(input())
	a = list(input())
	if a[0] == '>':
		print('0')
	else:
		ans = []
		for i in range(an):
			if a[i] == '>':
				ans.append(i)
				break
		for i in range(an - 1, -1, -1):
			if a[i] == '<':
				ans.append(an - 1 - i)
				break
		print(min(ans))


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))


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


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)


q = int(input())
for _ in range(q):
	n = int(input())
	A = input()
	best = n
	for i in range(n):
		if A[i] == '>':
			best = min([best, i])
	for i in range(n):
		if A[i] == '<':
			best = min([best, n - i - 1])
	print(best)


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))


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


import sys
sys.setrecursionlimit(2000)
from collections import Counter
from functools import reduce
t = [int(val) for val in sys.stdin.readline().split()][0]
for test in range(t):
	n = [int(val) for val in sys.stdin.readline().split()][0]
	s = input()
	if s[0] == '>' or s[-1] == '<':
		ans = 0
	else:
		c1 = n
		for i in range(n):
			if s[i] == '>':
				c1 = min(i, c1)
		c2 = -1
		for i in range(n - 1, -1, -1):
			if s[i] == '<':
				c2 = max(i, c2)
		c2 = n - 1 - c2
		ans = min(c1, c2)
	print(ans)


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))


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


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


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


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)


t = int(input())
for l in range(t):
	n = int(input())
	s = input()
	right = left = 1000000000
	for i in range(len(s)):
		if s[i] == '>':
			left = i
			break
	for i in range(len(s) - 1, -1, -1):
		if s[i] == '<':
			right = n - (i + 1)
			break
	print(min(left, right))


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))


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


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])


b = ((int(input()), input()) for _ in range(int(input())))
a = (str(min(s[::-1].find('<') % n, s.find('>') % n)) for (n, s) in b)
print('\n'.join(a))


loop_times = int(input())
for t in range(loop_times):
	length = int(input())
	string = input()
	left = 0
	right = 0
	for i in range(length):
		if string[i] != '>':
			left += 1
		else:
			break
	for i in range(length):
		j = length - 1 - i
		if string[j] != '<':
			right += 1
		else:
			break
	print(min(left, right))


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


def cnt(s, i, j):
	if s[i] == '>' or s[j] == '<' or i == j:
		return 0
	else:
		return 1 + cnt(s, i + 1, j - 1)
T = int(input())
for i in range(T):
	N = int(input())
	s = input()
	print(cnt(s, 0, 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('<')))


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


q = int(input())
for i in range(q):
	w = int(input())
	e = input()
	if e[0] == '>' or e[w - 1] == '<':
		print(0)
	else:
		r = e.find('>')
		t = w - e.rfind('<') - 1
		print(min(r, t))


n = int(input())
for i in range(n):
	m = int(input())
	my_string = input()
	if my_string[0] == '>' or my_string[-1] == '<':
		print(0)
	else:
		for j in range(m):
			if my_string[j] == '>':
				first_right_ind = j
				break
		for k in range(m - 1, -1, -1):
			if my_string[k] == '<':
				first_left_ind = k
				break
		print(min(first_right_ind, m - 1 - first_left_ind))


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))


a = int(input())
for i in range(a):
	m = int(input())
	n = input()
	ans1 = 0
	ans2 = 0
	for p in range(m):
		if n[p] is '>':
			break
		ans1 += 1
	for q in range(m - 1, -1, -1):
		if n[q] is '<':
			break
		ans2 += 1
	print(min(ans1, ans2))


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


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


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)


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


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)


for _ in range(int(input())):
	n = int(input())
	s = input()
	ans = 0
	if s[0] == s[n - 1] or (s[0] == '>' and s[n - 1] == '<') or n == 1:
		print(ans)
		continue
	currans1 = 0
	for i in range(n):
		if s[i] == '>':
			break
		currans1 += 1
	currans2 = 0
	for j in range(n - 1, -1, -1):
		if s[j] == '<':
			break
		currans2 += 1
	print(min(currans1, currans2))


from collections import deque as de
import math
from collections import Counter as cnt
from functools import reduce
from typing import MutableMapping
from itertools import groupby as gb

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

class My_stack:

	def __init__(self):
		self.data = []

	def my_push(self, x):
		return self.data.append(x)

	def my_pop(self):
		return self.data.pop()

	def my_peak(self):
		return self.data[-1]

	def my_contains(self, x):
		return self.data.count(x)

	def my_show_all(self):
		return self.data

	def isEmpty(self):
		return len(self.data) == 0
arrStack = My_stack()

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def get_prime_factors(number):
	prime_factors = []
	while number % 2 == 0:
		prime_factors.append(2)
		number = number / 2
	for i in range(3, int(math.sqrt(number)) + 1, 2):
		while number % i == 0:
			prime_factors.append(int(i))
			number = number / i
	if number > 2:
		prime_factors.append(int(number))
	return prime_factors

def get_frequency(list):
	dic = {}
	for ele in list:
		if ele in dic:
			dic[ele] += 1
		else:
			dic[ele] = 1
	return dic

def Log2(x):
	return math.log10(x) / math.log10(2)

def isPowerOfTwo(n):
	return math.ceil(Log2(n)) == math.floor(Log2(n))
t = int(input())
while t:
	t -= 1
	n = int(input())
	s = input()
	if len(set(s)) == 1:
		print(0)
	elif s[0] == '>' or s[n - 1] == '<':
		print(0)
	elif n == 2:
		if s[0] == '>' or s[n - 1] == '<':
			print(0)
		else:
			print(1)
	else:
		for i in range(n - 1):
			if s[i] == '>':
				break
		for j in range(n - 1, 0, -1):
			if s[j] == '<':
				break
		print(min(i, n - j - 1))


for i in range(int(input())):
	o = int(input())
	p = input()
	(t, w) = (999999999, 9999999999)
	if '>' in p:
		t = p.index('>')
	if '<' in p:
		w = o - 1 - p.rindex('<')
	print(min(t, w))


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


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)


t5 = int(input())
t1 = 0
while t1 != t5:
	t1 += 1
	n = int(input())
	s = input()
	ans = 0
	if s[0] == '>' or s[-1] == '<':
		print(ans)
	else:
		irig = s.find('>')
		ilef = s.rfind('<')
		pirig = irig + 1
		ilef = ilef - n
		pilef = ilef * -1
		if pirig == pilef:
			print(pirig - 1)
		elif pirig > pilef:
			print(pilef - 1)
		elif pirig < pilef:
			print(pirig - 1)


n = int(input(''))
st = []
for i in range(n):
	length = input('')
	st.append(input(''))
change = []
for i in st:
	a = 0
	b = 0
	x = 0
	y = -1
	if '>' in i:
		a = i.index('>')
	while (i[y] == '>') & (a > 0):
		b += 1
		y -= 1
	change.append(min(a, b))
for i in change:
	print(i)


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)))


import sys

class Main:

	def __init__(self):
		self.buff = None
		self.index = 0

	def next(self):
		if self.buff is None or self.index == len(self.buff):
			self.buff = sys.stdin.readline().split()
			self.index = 0
		val = self.buff[self.index]
		self.index += 1
		return val

	def next_int(self):
		return int(self.next())

	def cal(self, s):
		if len(s) == 1:
			return s[0]
		if s[0] == 0:
			return self.cal(s[1:])
		v = 1
		for c in s:
			v *= c
		return v

	def solve(self):
		n = self.next_int()
		for _ in range(0, n):
			lx = self.next_int()
			s = self.next()
			ll = 0
			rr = 0
			while ll < lx and s[ll] != '>':
				ll += 1
			while rr < lx and s[-rr - 1] != '<':
				rr += 1
			print(min(ll, rr))
Main().solve()


import math
import sys
import bisect
t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	(cntl, cntr) = (0, 0)
	(maxl, maxr) = (0, 0)
	for i in range(n):
		if s[i] == '>':
			break
		maxl += 1
	for i in range(n - 1, -1, -1):
		if s[i] == '<':
			break
		maxr += 1
	print(min(maxl, maxr))


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))


for _ in range(int(input())):
	n = int(input())
	array = input()
	i = 0
	dele = 0
	cool = 1
	done = 0
	one = 0
	two = 0
	if array[0] == '>' or array[-1] == '<':
		print(dele)
	else:
		i = 0
		while i < len(array):
			while array[i] == '<':
				one += 1
				i += 1
			break
		i = len(array) - 1
		while i > -1:
			while array[i] == '>':
				two += 1
				i -= 1
			break
		print(min(two, one))


import sys
import math
from collections import defaultdict, deque
input = sys.stdin.readline

def inar():
	return [int(el) for el in input().split()]

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		st = input().strip()
		ans1 = 10 ** 18
		for i in range(n - 1, -1, -1):
			if st[i] == '<':
				ans1 = n - i - 1
				break
		ans2 = 10 ** 18
		for i in range(n):
			if st[i] == '>':
				ans2 = i
				break
		print(min(ans1, ans2))
main()


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


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))


for _ in range(int(input())):
	input()
	s = input()
	l = r = 100500
	if '>' in s:
		l = s.find('>')
	if '<' in s:
		r = len(s) - s.rfind('<') - 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)


from sys import stdin

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

def mi():
	return map(int, stdin.readline().split())

def li():
	return list(mi())
for _ in range(ii()):
	x = 0
	n = ii() - 1
	a = input()
	while a[x] != '>' and a[n - x] != '<':
		x += 1
	print(x)


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


t = int(input())
while t > 0:
	s = input()
	s = input()
	if '>' not in s:
		print(s[::-1].index('<'))
	elif '<' not in s:
		print(s.index('>'))
	else:
		print(min(s.index('>'), s[::-1].index('<')))
	t -= 1


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 _ in range(t):
	n = int(input())
	s = input()
	ans1 = n
	ans2 = n
	for i in range(n):
		if s[i] == '>':
			ans1 = i
			break
	for i in range(n):
		if s[i] == '<':
			ans2 = n - i - 1
	print(min(ans1, ans2))


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))


for i in range(int(input())):
	n = int(input())
	s = list(input())
	f = []
	for j in range(n):
		if len(f) == 0 or f[-1] != '>':
			f.append(s[j])
	m = []
	for j in range(n - 1, -1, -1):
		if len(m) == 0 or m[-1] != '<':
			m.append(s[j])
	print(min(len(m), len(f)) - 1)


t = int(input())
strings = []
answers = []
for i in range(t):
	ignore = input()
	strings.append(input())
	answers.append(0)
for i in range(t):
	for j in range(len(strings[i])):
		if strings[i][j] == '>' or strings[i][-(j + 1)] == '<':
			break
		else:
			answers[i] = answers[i] + 1
for i in range(t):
	print(answers[i])


TC = int(input())
for tc in range(TC):
	N = int(input())
	S = input()
	ans = N - 1
	f = S.find('>')
	if f != -1:
		ans = min(ans, f)
	f = S.rfind('<')
	if f != -1:
		ans = min(ans, N - 1 - f)
	print(ans)


t = int(input())
outputs = []
for i in range(t):
	length = int(input())
	string = input()
	outputs.append(min(string.find('>') if string.find('>') != -1 else length + 1, length - string.rfind('<') - 1))
print(*outputs, sep='\n')


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())
for i in range(t):
	n = int(input())
	s = input()
	le = 0
	ri = n - 1
	while (s[le] != '>') & (le < n - 1):
		le += 1
	while (s[ri] != '<') & (ri > 0):
		ri -= 1
	print(min(le, n - ri - 1))


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[-1] == '<':
		print(0)
	else:
		a = -1
		b = -1
		a = s.index('>')
		s = s[::-1]
		for x in s:
			if x == '<':
				b = s.index(x)
				break
		print(min(a, b))


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)


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	print(min(s[::-1].find('<') % n, s.find('>') % n))


t = int(input())
for i in range(t):
	a = int(input())
	s = input()
	print(min(s.find('>') % 10000000000, a - s.rfind('<') - 1))


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


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	s = input().strip()
	for i in range(n):
		if s[i] == '>' or s[-1 - i] == '<':
			print(i)
			break


t = int(input())
while t:
	t -= 1
	n = int(input())
	s = input()
	l = 0
	while l < n and s[l] != '>':
		l += 1
	r = n - 1
	while r >= 0 and s[r] != '<':
		r -= 1
	print(min(min(l, n - 1 - r), n - 1))


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


for _ in range(int(input())):
	n = int(input())
	p = input()
	q = p[::-1]
	a = p.find('>')
	b = q.find('<')
	if a == -1:
		print(b)
	elif b == -1:
		print(a)
	else:
		print(min(a, b))


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)


t = int(input())
ans = []
for _ in range(t):
	n = int(input())
	s = input()
	count1 = 0
	count2 = 0
	k = s[::-1]
	for i in range(n):
		if s[i] != '>':
			count1 += 1
		else:
			break
	for i in range(n):
		if k[i] != '<':
			count2 += 1
		else:
			break
	ans.append(min(count1, count2))
print(*ans)


n = int(input())
Tests = []
for i in range(2 * n):
	if i % 2 == 0:
		input()
		continue
	else:
		Tests.append(input())
for i in range(n):
	max_left = 10 ** 6
	max_right = 10 ** 6
	for j in range(len(Tests[i])):
		if Tests[i][j] == '>':
			max_left = j
			break
	for j in range(len(Tests[i])):
		if Tests[i][::-1][j] == '<':
			max_right = j
			break
	print(min(max_left, max_right))


import sys
sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline
N = int(input())
ans = []
for _ in range(N):
	n = int(input())
	s = input()[:-1]
	if all((c == '<' for c in s)):
		ans.append(0)
	elif all((c == '>' for c in s)):
		ans.append(0)
	else:
		first = -1
		last = -1
		for i in range(n):
			if s[i] == '>':
				first = i
				break
		for i in reversed(range(n)):
			if s[i] == '<':
				last = n - i - 1
				break
		ans.append(min(first, last))
print('\n'.join(map(str, ans)))


for _ in range(int(input())):
	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
	ans = min(i, n - 1 - j, n - 1)
	print(ans)


import sys, math, queue
sys.setrecursionlimit(1000000)
for _ in range(int(input())):
	n = int(input())
	s = input()
	a1 = n + n
	a2 = n + n
	a = 0
	for i in range(n):
		if s[i] != '>':
			a += 1
		else:
			a1 = a
			break
	a = 0
	for i in range(-1, -1 - n, -1):
		if s[i] != '<':
			a += 1
		else:
			a2 = a
			break
	print(min(a1, a2))


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))


n = int(input())
for i in range(n):
	cal = 0
	l = int(input())
	s = input()
	if s[0] == '>' or s[l - 1] == '<':
		print(0)
	else:
		j = 0
		k = l - 1
		while s[j] != '>' and s[k] != '<':
			cal += 1
			j += 1
			k -= 1
		print(cal)


for i in range(int(input())):
	n = int(input())
	s = str(input())
	s = list(s)
	if n == 1:
		print(0)
	else:
		st = s[0]
		en = s[-1]
		if st == '>' or en == '<':
			print(0)
		else:
			if '>' in s:
				c1 = s.index('>')
			if '<' in s:
				s.reverse()
				c2 = s.index('<')
			print(min(c1, c2))


def f(a):
	move_left = 0
	for char in a:
		if char == '>':
			break
		else:
			move_left += 1
	if move_left == 0:
		return 0
	move_right = 0
	for char in a[::-1]:
		if char == '<':
			break
		else:
			move_right += 1
	return min(move_left, move_right)
t = int(input())
for _ in range(t):
	n = int(input())
	a = input()
	print(f(a))


import sys
sys.setrecursionlimit(10 ** 5 + 1)
inf = int(10 ** 20)
max_val = inf
min_val = -inf
RW = lambda : sys.stdin.readline().strip()
RI = lambda : int(RW())
RMI = lambda : [int(x) for x in sys.stdin.readline().strip().split()]
RWI = lambda : [x for x in sys.stdin.readline().strip().split()]

def solve(s, lens):
	return min(s.find('>') % lens, s[::-1].find('<') % lens)
nb_test = RI()
for _ in range(nb_test):
	lens = RI()
	curr = RW()
	print(solve(curr, lens))


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))


import os
import sys
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')
from collections import Counter
import sys
import math
from math import gcd
for _ in range(int(input())):
	n = int(input())
	s = input()
	ans = n - 1
	for i in range(n):
		if s[i] == '>' or s[n - i - 1] == '<':
			ans = min(ans, i)
	print(ans)


for t in range(int(input())):
	n = int(input())
	s = input()
	res = 10 ** 10
	if s.find('>') != -1:
		res = min(res, s.find('>'))
	if s.rfind('<') != -1:
		res = min(res, n - 1 - s.rfind('<'))
	print(res)


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)


def ri():
	return int(input())

def rl():
	return list(map(int, input().split()))
q = ri()
for _ in range(q):
	n = ri()
	s = input()
	if s[0] == '>' or s[-1] == '<':
		print(0)
	else:
		start = 1
		last = n - 1
		for i in range(1, n):
			if s[i] == '>':
				start = i
				break
		for i in range(n - 1, -1, -1):
			if s[i] == '<':
				end = i
				break
		if start < end:
			print(min(start, n - 1 - end))
		else:
			print(min(end + 1, n - start))


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	(a, b) = (999999999, 9999999999)
	if '>' in s:
		a = s.index('>')
	if '<' in s:
		b = n - 1 - s.rindex('<')
	print(min(a, b))


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)


def solve():
	n = int(input())
	s = input()
	(f, l) = (2000, 2000)
	for i in range(0, n):
		if s[i] == '>' and f == 2000:
			f = i + 1
		elif s[i] == '<':
			l = i + 1
	if s[0] == '>' or s[n - 1] == '<':
		print('0')
	else:
		print(min(f - 1, n - l))

def main():
	t = int(input())
	for i in range(0, t):
		solve()
main()


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)


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


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))


t = int(input())

def fan(k, s):
	a = 0
	b = 0
	for i in range(len(s)):
		if s[i] == '>':
			break
		else:
			a += 1
	s1 = s[::-1]
	for i in range(len(s)):
		if s1[i] == '<':
			break
		else:
			b += 1
	return min(a, b)

def main():
	for _ in range(t):
		n = int(input())
		s = input()
		print(fan(n, s))
main()


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()


TN = int(input())

def solution():
	n = int(input())
	s = list(input())
	ind1 = -1
	ind2 = 0
	cur = 1
	for i in range(n):
		if s[i] == '>' and cur:
			cur = 0
			ind1 = i
		if s[i] == '<':
			ind2 = i
	print(min(len(s[:ind1]), len(s[ind2 + 1:])))
while TN != 0:
	solution()
	TN -= 1


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))


n = int(input())

def answer(s):
	if len(s) == 1 or s[0] == '>' or s[len(s) - 1] == '<':
		return 0
	i1 = s.find('>')
	i2 = len(s) - s.rfind('<') - 1
	return min(i1, i2)
for i in range(n):
	k = input()
	s = input()
	print(answer(s))


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)


t = int(input())

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


t = int(input())
for k in range(t):
	n = int(input())
	s = input()
	c = n + 1
	for i in range(n):
		if s[i] == '>':
			c = i
			break
	d = n + 1
	for i in range(n):
		if s[n - i - 1] == '<':
			d = i
			break
	print(min(d, c))


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))


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


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('<'))))


def main():
	n = int(input())
	strings = []
	for i in range(n):
		lenght = int(input())
		strings.append((input(), lenght))
	for (s, l) in strings:
		if s[0] == '>' or l == 1 or s[-1] == '<':
			print(0)
			continue
		min_len = l
		for i in range(l):
			if s[i] == '>':
				min_len = min(min_len, i, l - i)
				break
		counter = 0
		for i in range(l - 1, -1, -1):
			if s[i] == '<':
				min_len = min(min_len, counter, l - counter)
				break
			counter += 1
		print(min_len)
main()


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


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


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())
	l = input()
	i = 0
	while True:
		if l[i] == '>' or l[-(i + 1)] == '<':
			break
		i += 1
	print(i)


import io, sys, atexit, os
import math as ma
from sys import exit
from decimal import Decimal as dec
from itertools import permutations

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

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

def nu():
	return int(input())

def find_gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
mm = 1000000007

def solve():
	t = nu()
	for it in range(t):
		n = nu()
		s = input()
		if s[0] == '>':
			print(0)
			continue
		if s[n - 1] == '<':
			print(0)
			continue
		cc = 0
		cp = 0
		for i in range(n):
			if s[i] == '>':
				break
			cc += 1
		for i in range(n - 1, -1, -1):
			if s[i] == '<':
				break
			cp += 1
		print(min(cc, cp))
solve()


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)


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


t = int(input())
for i in range(t):
	l = int(input())
	stt = input()
	try:
		p1 = stt.index('>')
	except:
		p1 = 0
	try:
		p2 = stt.rindex('<') + 1
	except:
		p2 = l
	answ = min(p1, l - p2)
	print(answ)


for _ in range(int(input())):
	n = int(input())
	s = input()
	se = so = 0
	if s.count('<') == n or s.count('>') == n:
		print(0)
		continue
	if n == 1:
		print(0)
		continue
	if n == 2:
		if s == '<<' or s == '>>' or s == '><':
			print(0)
		else:
			print(1)
		continue
	for i in range(n):
		if s[i] == '>':
			break
		else:
			so += 1
	for i in range(n):
		if s[n - i - 1] == '<':
			break
		else:
			se += 1
	print(min(se, so))


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))


t = int(input())
for rou in range(t):
	n = int(input())
	s = input()
	r = 999
	if s.find('>') != -1:
		r = s.find('>')
	if s.rfind('<') != -1 and n - s.rfind('<') - 1 < r:
		r = n - s.rfind('<') - 1
	print(r)


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


for i in range(int(input())):
	x = int(input())
	y = input()
	print(min(y.index('>') if '>' in y else 10000000, y[::-1].index('<') if '<' in y else 100000000))


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


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


def gc(s):
	(a, b) = (n, n)
	if '>' in s:
		a = s.index('>')
	if '<' in s:
		b = s[::-1].index('<')
	return min(a, b)
t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	print(gc(s))


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())
	x = input()
	q = 1000000
	p = -1000000
	for i in range(n):
		if x[i] == '<':
			p = max(p, i + 1)
		elif x[i] == '>':
			q = min(q, i)
	print(min(n - p, q))


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))


n = int(input())
for i in range(n):
	a = int(input())
	st = input()
	i = 0
	max1 = 0
	max2 = 0
	while i < a and st[i] != '>':
		max1 += 1
		i += 1
	i = a - 1
	while i >= 0 and st[i] != '<':
		max2 += 1
		i -= 1
	print(min(max1, max2))


import sys
t = int(sys.stdin.readline())
for i in range(t):
	n = int(sys.stdin.readline())
	s = input()
	res = n - 1
	for i in range(n):
		if s[i] == '>' or s[n - 1 - i] == '<':
			res = min(res, i)
	print(res)


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))


def find_min_dels(str):
	n = len(str)
	ind1 = n
	ind2 = n - 1
	for i in range(n - 1):
		if str[i] == '>':
			ind1 = i
			break
	for i in range(n - 1, -1, -1):
		if str[i] == '<':
			ind2 = i
			break
	return min(ind1, n - 1 - ind2)

def read_input(flag=0):
	if flag > 0:
		return input()
	return int(input())
t = read_input()
for i in range(t):
	n = read_input()
	s = read_input(1)
	assert len(s) == n
	print(find_min_dels(s))


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


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))


def solve():
	t = inp()
	for _ in range(t):
		n = inp()
		l = strl()
		mini = sys.maxsize
		if len(set(l)) == 1:
			print(0)
		else:
			x = l[::-1].index('<')
			mini = min(x, n - x, mini)
			y = l.index('>')
			mini = min(y, n - y, mini)
			print(mini)
import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
inp = lambda : int(input())
strng = lambda : input().strip()
jn = lambda x, l: x.join(map(str, l))
strl = lambda : list(input().strip())
mul = lambda : map(int, input().strip().split())
mulf = lambda : map(float, input().strip().split())
seq = lambda : list(map(int, input().strip().split()))
ceil = lambda x: int(x) if x == int(x) else int(x) + 1
ceildiv = lambda x, d: x // d if x % d == 0 else x // d + 1
flush = lambda : stdout.flush()
stdstr = lambda : stdin.readline()
stdint = lambda : int(stdin.readline())
stdpr = lambda x: stdout.write(str(x))
solve()


n = int(input())
for i in range(n):
	s = int(input())
	S = input()
	if S.count('<') == s or S.count('>') == s:
		print(0)
		continue
	else:
		x1 = S.index('<')
		y1 = S.index('>')
		(x2, y2) = (None, None)
		ct = len(S) - 1
		while ct >= 0:
			if S[ct] == '>' and (not y2):
				y2 = ct
			elif S[ct] == '<' and (not x2):
				x2 = ct
			ct -= 1
		if y1 < x1 or y2 < x2:
			print(0)
		else:
			print(min(y2 - x2, y1 - x1))


t = int(input())
for test in range(t):
	leng = int(input())
	s = input()
	if s[0] == '>' or s[-1] == '<':
		print(0)
	else:
		ans1 = 0
		ans2 = 0
		for e in s:
			if e != '>':
				ans1 += 1
			else:
				break
		for i in range(len(s) - 1, -1, -1):
			e = s[i]
			if e != '<':
				ans2 += 1
			else:
				break
		print(min(ans1, ans2))


Q = int(input())
for _ in range(Q):
	N = int(input())
	s = input()
	mi = N - 1
	for i in range(N):
		if s[i] == '>':
			mi = i
			break
	for i in range(N):
		if s[N - 1 - i] == '<':
			mi = min(mi, i)
			break
	print(mi)


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))


def n_str(string):
	if string[0] == '>':
		return 0
	if string[-1] == '<':
		return 0
	if len(string) == 2:
		return 1
	return 1 + n_str(string[1:len(string) - 1])
n = int(input())
tab = []
for i in range(n):
	temp = input()
	string = input()
	ntime = n_str(string)
	tab.append(ntime)
for i in tab:
	print(i)


t = int(input())
for q in range(t):
	n = int(input())
	s = input()
	id1 = -1
	for i in range(n):
		if s[i] == '>':
			id1 = i
			break
	id2 = -1
	i = n - 1
	while i >= 0:
		if s[i] == '<':
			id2 = i
			break
		i -= 1
	if id1 == -1:
		print(n - 1 - id2)
	elif id2 == -1:
		print(id1)
	else:
		left = id1
		right = n - 1 - id2
		print(min([left, right]))


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))


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


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


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


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)


amount = int(input())
for i in range(amount):
	len_ = int(input())
	string = input()
	if string[0] == '>' or string[-1] == '<':
		print(0)
		continue
	else:
		left = string.find('>')
		right = string.rfind('<')
		print(min(left, len(string) - 1 - right))


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))


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import *
from copy import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
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')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(a, b):
	ans = 1
	while b > 0:
		if b % 2 == 1:
			ans *= a
		a *= a
		b //= 2
	return ans

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def solve():
	n = int(inp())
	s = list(inp())
	if s[0] == '>':
		print(0)
		return
	if s[n - 1] == '<':
		print(0)
		return
	ans = 10 ** 9
	for i in range(n):
		if s[i] == '>':
			ans = min(ans, i)
			break
	for i in range(n - 1, -1, -1):
		if s[i] == '<':
			ans = min(ans, n - i - 1)
	print(ans)
testcase(int(inp()))


n = int(input())
while n != 0:
	m = int(input())
	l = input()
	a = l.find('>')
	b = m - l.rfind('<') - 1
	if a == -1:
		print(b)
	elif b == -1:
		print(a)
	else:
		print(min(a, b))
	n -= 1


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))


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


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))


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


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):
	n = int(input())
	s = input()
	(ans, ans2) = (0, 0)
	if n == 1:
		print(0)
	else:
		if '>' in s:
			ans += n - 1 - s.index('>')
		if '<' in s:
			ans2 += n - s[::-1].index('<') - 1
		abc = n - max(ans, ans2)
		print(abc - 1)


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)


t = eval(input())
for i in range(t):
	le = eval(input())
	s = input()
	ans = 0
	for c in s:
		if c == '>':
			break
		ans += 1
	if ans == le:
		ans -= 1
	ans2 = 0
	for c in s[::-1]:
		if c == '<':
			break
		ans2 += 1
	if ans2 == le:
		ans2 -= 1
	print(min(ans, ans2))


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))


t = int(input())

def leftest_to_right(s):
	for i in range(len(s)):
		if s[i] == '>':
			return i
	return 0

def rightest_to_left(s):
	for i in range(len(s) - 1, -1, -1):
		if s[i] == '<':
			return n - i - 1
	return 0
for ex in range(t):
	n = int(input())
	s = str(input())
	print(min(leftest_to_right(s), rightest_to_left(s)))


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


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))


from collections import Counter
import string
import math
import sys
from fractions import Fraction
from itertools import product

def array_int():
	return [int(i) for i in sys.stdin.readline().split()]

def vary(arrber_of_variables):
	if arrber_of_variables == 1:
		return int(sys.stdin.readline())
	if arrber_of_variables >= 2:
		return map(int, sys.stdin.readline().split())

def makedict(var):
	return dict(Counter(var))

def printDivisors(n):
	divisors = []
	i = 1
	while i <= math.sqrt(n):
		if n % i == 0:
			if n // i == i:
				divisors.append(i)
			else:
				divisors.extend((i, n // i))
		i = i + 1
	return divisors

def countTotalBits(num):
	binary = bin(num)[2:]
	return len(binary)

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
mod = 10 ** 9 + 7

def comp(x):
	return x[1]

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, n + 1):
		if prime[p]:
			primes.append(p * p)
	primes = []

def binary_search(arr, x):
	low = 0
	high = len(arr) - 1
	mid = 0
	while low <= high:
		mid = (high + low) // 2
		if arr[mid] < x:
			low = mid + 1
		elif arr[mid] > x:
			high = mid - 1
		else:
			return mid
	return -1

def lcm(a, b):
	return a * b // math.gcd(a, b)

def primeFactors(n):
	factors = []
	while n % 2 == 0:
		factors.append(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			factors.append(i)
			n = n // i
	if n > 2:
		factors.append(n)
	return factors
mod = 10 ** 9 + 7
testCases = 1
testCases = vary(1)
for _ in range(testCases):
	n = vary(1)
	s = input()
	if n == 1:
		print(0)
		continue
	beg = last = 0
	for i in s:
		if i != '>':
			beg += 1
		else:
			break
	s = s[::-1]
	for i in s:
		if i != '<':
			last += 1
		else:
			break
	print(min(beg, last))


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)


k = int(input())
for i in range(k):
	_ = input()
	s = input()
	if s.startswith('>') or s.endswith('<'):
		print(0)
		continue
	left = s.find('>') + 1
	right = s.rfind('<') + 1
	print(min(left - 1, len(s) - right))


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)


for _ in range(int(input())):
	l = int(input())
	s = input()
	c = l - 1
	for i in range(l):
		if s[i] == '>' or s[l - i - 1] == '<':
			c = min(c, i)
	print(c)


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))


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


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())
ansarr = []
for l in range(t):
	n = int(input())
	s = str(input())
	if n == 1:
		ansarr.append(0)
	elif s[0] == '>':
		ansarr.append(0)
	elif s[-1] == '<':
		ansarr.append(0)
	else:
		count1 = 0
		count2 = 0
		for i in range(n):
			if s[i] == '>':
				break
			else:
				count1 += 1
		for i in range(n - 1, -1, -1):
			if s[i] == '<':
				break
			else:
				count2 += 1
		ansarr.append(min(count1, count2))
print(*ansarr)


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 q in range(t):
	n = int(input())
	s = input()
	amount = 0
	i = 0
	while i < n and s[i] != '>' and (s[n - i - 1] != '<'):
		amount += 1
		i += 1
	print(amount)


import math

def inintgen():
	return (int(x) for x in input().split())

def inint():
	return [int(x) for x in input().split()]

def main():
	t = int(input())
	for i in range(t):
		i = int(input())
		s = input()
		sr = s[::-1]
		cnt = 0
		for j in range(len(s)):
			if s[j] == '>' or sr[j] == '<':
				break
			cnt += 1
		print(cnt)
main()


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 = int(input())
	s = input()
	l1 = n - len(s.lstrip('<'))
	l2 = n - len(s.rstrip('>'))
	print(min(l1, l2))


le = int(input())
for _ in range(le):
	n = int(input())
	st = input()
	if st[-1] == '<' or st[0] == '>':
		print(0)
	else:
		ct1 = ct2 = 0
		for i in range(n):
			if st[i] != '>':
				ct1 += 1
			else:
				break
		for i in range(n - 1, -1, -1):
			if st[i] != '<':
				ct2 += 1
			else:
				break
		print(min(ct1, ct2))


import os
import sys
import string
import math

def solution(s):
	result = []
	if '>' in s:
		result.append(s.index('>'))
	if '<' in s:
		result.append(s[::-1].index('<'))
	return min(result)

def main(cases):
	for c in cases:
		print(solution(c))

def parse():
	nums = int(input())
	cases = []
	for _ in range(nums):
		l = int(input())
		s = input()
		cases.append(s)
	return cases
main(parse())


n = int(input())
for i in range(n):
	x = int(input())
	s = input()
	s1 = s
	s2 = s
	count = 0
	if len(s) == 1:
		print(0)
	else:
		while s2[0] != '>' and s1[len(s1) - 1] != '<':
			s1 = s1[0:len(s1) - 1]
			s2 = s2[1:len(s2)]
			count += 1
		print(count)


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))


LESS = '<'
MORE = '>'

def make_good_string():
	n = int(input())
	s = input()
	left_less = 0
	right_more = 0
	for i in range(n):
		if s[i] == MORE:
			break
		left_less += 1
	for i in reversed(range(n)):
		if s[i] == LESS:
			break
		right_more += 1
	if not left_less or not right_more:
		return 0
	return left_less if left_less < right_more else right_more

def main():
	tests_count = int(input())
	for i in range(tests_count):
		print(make_good_string())
main()


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


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


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(n):
	x = int(input())
	s = str(input())
	ss = s + ''
	d = 0
	f = 0
	while len(s) > 1:
		if len(s) == 1:
			break
		elif s[0] == '>' or s[-1] == '<':
			break
		else:
			s = s[1:]
			d += 1
	s = ss + ''
	while len(s) > 1:
		if len(s) == 1:
			break
		elif s[0] == '>' or s[-1] == '<':
			break
		else:
			s = s[:-1]
			f += 1
	print(min(f, d))


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))


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


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)


t = int(input())
for _ in range(t):
	input()
	s = input()
	cl = 0
	for c in s:
		if c == '>':
			break
		cl += 1
	cr = 0
	for c in s[::-1]:
		if c == '<':
			break
		cr += 1
	print(min(cl, cr))


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


for _ in range(int(input())):
	n = int(input())
	s = input()
	i = s.find('>')
	if i == -1:
		i = 1000000
	s = s[::-1]
	j = s.find('<')
	if j == -1:
		j = 1000000
	print(min(i, j))


def countbeginning(s):
	if '>' not in s:
		return len(s)
	else:
		return s.index('>')

def countend(s):
	t = ''.join(reversed(list(s)))
	if '<' not in t:
		return len(t)
	else:
		return t.index('<')
numcases = int(input())
for i in range(numcases):
	n = int(input())
	s = input()
	print(min(countbeginning(s), countend(s)))


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))


le = int(input())
while le:
	n = int(input())
	s = input()
	i = 0
	while s[i] != '>' and i < n - 1:
		i += 1
	mi = i
	i = n - 1
	while s[i] != '<' and i > 0:
		i -= 1
	ma = n - (i + 1)
	print(min(n - 1, mi, ma))
	le -= 1


for _ in range(int(input())):
	n = int(input())
	p = input()
	if len(set(p)) == 1:
		print(0)
	else:
		i = p.index('>')
		q = p[::-1].index('<')
		print(min(i, q))


count = int(input())
for x in range(count):
	input()
	temp = list(input())
	if temp[0] == '>' or temp[-1] == '<':
		print(0)
	else:
		s1 = temp.index('>')
		s2 = temp[::-1].index('<')
		print(min(s1, s2))


import math
n = int(input())
for i in range(n):
	k = int(input())
	a = input()
	y = a.find('>')
	u = a.rfind('<')
	if a[0] == '>' or a[-1] == '<':
		print(0)
	else:
		print(min(y, k - u - 1))


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))


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def main():
	n = I()
	aa = [[I(), S()] for _ in range(n)]
	rr = []
	for (k, s) in aa:
		a = 0
		for c in s:
			if c == '>':
				break
			a += 1
		b = 0
		for c in s[::-1]:
			if c == '<':
				break
			b += 1
		rr.append(min(a, b))
	return '\n'.join(map(str, rr))
print(main())


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


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())
	X = input()
	if X.count(X[0]) == N or X[0] == '>':
		print(0)
		continue
	print(min(X[::-1].index('<'), X.index('>')))


import sys
from collections import defaultdict
strInp = lambda : input().strip().split()
intInp = lambda : list(map(int, strInp()))
t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	if s[0] == '>':
		print(0)
	elif s[n - 1] == '<':
		print(0)
	else:
		l = s.find('>')
		rs = s[::-1]
		r = rs.find('<')
		print(min(r, l))


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)


n = int(input())
lst = []
for _ in range(n):
	l = int(input())
	Str = input()
	if Str[0] == '>' or Str[-1] == '<':
		lst.append(0)
		continue
	else:
		lst.append(min(len(Str[:Str.index('>')]), len(Str[Str.rfind('<') + 1:])))
for x in lst:
	print(x)


import sys
a = int(input())
for i in range(0, a):
	b = int(input())
	s = input()
	print(min(s.find('>') % b, b - 1 - s.rfind('<')))


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


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))


for _ in ' ' * int(input()):
	(n, s) = (int(input()), input())
	i = 0
	while i < n - i - 1 and s[i] != '>' and (s[n - i - 1] != '<'):
		i += 1
	print(i)


from __future__ import division, print_function
import bisect
import math
import itertools
import sys
from atexit import register
if sys.version_info[0] < 3:
	from io import BytesIO as stream
else:
	from io import StringIO as stream
if sys.version_info[0] < 3:

	class dict(dict):

		def items(self):
			return dict.iteritems(self)

		def keys(self):
			return dict.iterkeys(self)

		def values(self):
			return dict.itervalues(self)
	input = raw_input
	range = xrange
	filter = itertools.ifilter
	map = itertools.imap
	zip = itertools.izip

def sync_with_stdio(sync=True):
	global input, flush
	if sync:
		flush = sys.stdout.flush
	else:
		sys.stdin = stream(sys.stdin.read())
		input = lambda : sys.stdin.readline().rstrip('\r\n')
		sys.stdout = stream()
		register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))

def main():
	for i in range(int(input())):
		n = int(input())
		s = input()
		x = 0
		y = n - 1
		while s[x] != '>' and s[y] != '<':
			x += 1
			y -= 1
		print(min(x - 0, n - 1 - y))
sync_with_stdio(False)
main()


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 _ in range(T):
	N = int(input())
	s = input()
	r = 0
	for c in s:
		if c == '>':
			break
		else:
			r += 1
	t = 0
	for c in reversed(s):
		if c == '<':
			break
		else:
			t += 1
	print(min(t, r))


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):
	n = int(input())
	char_list = input()
	num_to_rem = 0
	if char_list[0] == '>' or char_list[-1] == '<':
		print(0)
	else:
		count_from_left = 0
		for i in range(n):
			if char_list[i] == '>':
				break
			count_from_left += 1
		count_from_right = 0
		for i in range(n - 1, -1, -1):
			if char_list[i] == '<':
				break
			count_from_right += 1
		print(min(count_from_left, count_from_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)


t = int(input())
res = []
for _ in range(t):
	n = int(input())
	s = input().strip()
	for idx in range(n):
		if s[idx] == '>' or s[n - idx - 1] == '<':
			res.append(idx)
			break
for num in res:
	print(num, end='\n')


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))


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


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


cin = input
t = int(cin())
while t > 0:
	n = int(cin())
	s = input()
	print(min(s.find('>') % n, s[::-1].find('<') % n))
	t -= 1


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


import sys
from collections import defaultdict as dc
from collections import Counter
from bisect import bisect_right, bisect_left
import math
from operator import itemgetter
from heapq import heapify, heappop, heappush
for _ in range(int(input())):
	n = int(input())
	s = input()
	for i in range(n):
		if s[i] == '>':
			break
	s = s[::-1]
	for j in range(n):
		if s[j] == '<':
			break
	print(min(i, j))


t = int(input())
for T in range(t):
	n = int(input())
	str = input()
	if str[0] == '>' or str[-1] == '<':
		print(0)
	else:
		x = 1
		y = 1
		for i in range(1, n):
			if str[i] == str[i - 1]:
				x += 1
			else:
				break
		for i in range(n - 2, -1, -1):
			if str[i] == str[i + 1]:
				y += 1
			else:
				break
		print(min(x, y))


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))