for _ in range(input()):
    n=input()
    s=raw_input()
    x=0
    if '<'==s[0] and '>'==s[-1]:
        i,j=0,n
        while '<'==s[i]:
            i+=1
        while '>'==s[n-1-j]:
            j-=1
        x=min(i,n-j)
    print x