tsize = int(input())

def solve(slen, string):
    if string[0] == ">" or string[-1] == "<":
        return 0

    minrem = slen - 1
    counting = 1
    checking = string[0]
    for i, s in enumerate(string[1:]):
        if s == checking:
            counting += 1
        else:
            minrem = min(minrem, counting)
            
            if i != slen - 2:
                counting = 1
                checking = string[i+1]
    return minrem


for _ in range(0, tsize):

    slen = int(input())
    string = input()

    print(solve(slen, string))
