for _ in range(int(input())):
    n = int(input())
    lis=list(input())
    c=0
    for i in range(n-1):
        if lis[i]=='<' and lis[i+1]=='>':
            print(min(i+1,n-i+1))
            c=1
            break
    if c==0:
        print('0')
#    print(lis)