t = int(input())
for _ in range(t):
    n = int(input())
    s = input()
    left = 0
    right = 0
    for i in range(0, len(s)):
        if s[i] == '<':
            left += 1
        else:
            right += 1
    count = 0
    if left == 0 or right == 0:
        count = 0
    elif left < right:
        for i in range(len(s)):
            if i == len(s)-1 and s[i] == '<':
                continue
            elif s[i] == '<':
                count += 1
    elif left > right:
        for i in range(len(s)):
            if i == 0 and s[i] == '>':
                continue
            elif s[i] == '>':
                count += 1
    else:
        count1 = 0
        count2 = 0
        for i in range(len(s)):
            if i == 0 and s[i] == '>':
                continue
            elif i == len(s)-1 and s[i] == '<':
                continue
            elif s[i] == '<':
                count1 += 1
            elif s[i] == '>':
                count2 += 1
        if count1 < count2:
            count = count1
        else:
            count = count2
    print(count)
