# 1140B.py
for _ in range(int(input())):
    n = int(input())
    a = input()
    for i in range(n):
        if a[i]=='>':
            break
    ans = i
    for i in range(n-1,-1,-1):
        if a[i]=='<':
            break
    ans = min(i,n-i)

    print(ans)