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