def erases(s, right):
    res = 0
    for c in s:
        if right and c == '<' or not right and c == '>':
            res += 1
    return res

t = int(input())
for i in range(t):
    n = int(input())
    s = input()
    if n == 1:
        print(0)
        continue
    mn = 1000
    for j in range(n):
        mn = min(mn, erases(s[:j], True) + erases(s[j:], False))
    print(mn)
