n = int(input())
for i in range(n):
    m = int(input())
    s = input()
    num1 = 0
    num2 = 0
    j1 = 0
    j2 = m - 1
    while s[j1] == '<' and j1 < m:
        num1 += 1
        j1 += 1
    while s[j2] == '>' and j2 >= 0:
        num2 += 1
        j2 -= 1
    if j1 == 0 and j2 == m - 1:
        num1 = 0
        num2 = 0
        j1 = 0
        j2 = m - 1
        while s[j1] == '>' and j1 < m:
            num1 += 1
            j1 += 1
        while s[j2] == '<' and j2 >= 0:
            num2 += 1
            j2 -= 1        
        print(min(num1, num2))
    else:
        if j1 == m or j2 < 0:
            print(0)
        else:
            print(min(num1, num2))