test = int(input())
while test > 0:
    n = int(input())
    s = input()
    pos = -69
    for i in range(n):
        if s[i] == '>':
            pos = i-1
            break
    pos2 = n-1
    while pos2 > pos :
        if s[pos2] == '<':
            pos2 += 1
            break
        pos2 -= 1
    if pos == -1 or pos2 == -1:
        print("0")
    elif pos == pos2:
        print(n-1)
    else :
        print(pos+pos2)
    test -= 1