t = int(input())
status = False
for i in range(t):
    answer = 0
    status = False
    n = int(input())
    s = list(input())
    for k in range(1,len(s)):
        if (len(set(s[0:k])) == 1) and (s[0:k][0] == '<') and (len(set(s[k:len(s)])) == 1) and (s[k:len(s)][0] == '>'):
            status = True
            answer = min(len(s[0:k]), len(s[k:len(s)]))
    if status:
        print(answer)
    else:
        print('0')



