for _ in " " * int(input()):
    n = int(input()) + 1
    s = input() + "<"
    if "<>" not in s:
        print(0)
    else:
        f = 0
        if s[0] == ">" or s[-2] == "<":
            print(0)
        else:
            mx = 1000000
            ind = -1
            i = 0
            for i in range(n - 1):
                if s[i] == ">" and s[i + 1] == "<":
                    mx = min(mx, (i-ind)//2)
                    ind = i
            print(mx)