import sys
sys.setrecursionlimit(10 ** 6)
# pow(3,2,5)==4
def isg(s):
    f1=0
    count1=0
    f2=1
    count2=0
    for i in s:
        if i=="<":
            f1=1
            count1+=1
        if i==">":
            f2=1
            count2+=1
    return f1^f2,count1,count2
    # if f1 and f2:return 0
    # if (not f1) and (not f2):return 0
    # return 1
inp=input()
for i in range(inp):

    i2=input()
    inp2=raw_input()
    inp2r=""
    f=0
    s=[]
    # for i in inp2:
    #     if f:
    #         f=0
    #         continue
    #     if i==">":
    #         inp2r+=">"
    #         f=1
    #     else:inp2r+="<"
    # print inp2r,"ri"
    # inp2l=""
    # f=0
    # for i in inp2[-1]:
    #     if f:
    #         f=0
    #         continue
    #     if i=="<":
    #         inp2l+="<"
    #         f=1
    #     else:inp2r+=">"
    #
    # print inp2l,"le"
    # print isg(inp2)
    for i in inp2:
        if f:
            f=0
            s.pop()
            continue
        s.append(i)
        if i==">":
            f=1
    pp="".join(s)
    # print s,pp
    if isg(pp)[0]!=1:
        print min(isg(pp)[1],isg(pp)[2])
    else:
        print 0
