t = int(input())
for i in range(t):
    a = int(input())
    s = input()
    it = a - 1
    for i in range(a):
        if s[i] == ">" and s[a - i - 1] == "<" :
            it = min(it, i)
    print(it)
