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
        for i in range(n - 1, -1, -1):
            if s[i] != '<':
                b = b + 1
        print(min(a, b))
    else:
        print(0)
