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
    sc = s[:]
    for k in range(2):
        s = sc[:]
        if k:
            for j in range(n):
                if s[j] == '>':
                    s = s[:j + 1]
                    break
        else:
            for j in range(n - 1, -1, -1):
                if s[j] == '<':
                    s = s[j:]
                    break
        for j in range(len(s)):
            mn = min(mn, erases(s[:j], True) + erases(s[j:], False))
            mn = min(mn, j + erases(s[j:], True))
            mn = min(mn, erases(s[:j], False) + n - j)
    print(mn)
