def main():
    n = int(input())
    strings = []
    for i in range(n):
        lenght = int(input())
        strings.append((input(), lenght))

    for s, l in strings:
        if s[0] == '>' or len(s) == 1:
            print(0)
            continue

        blocks_len, current_len = [], 1
        is_bad = False
        for i in range(1, l):
            if s[i] == '>':
                blocks_len.append(current_len)
                blocks_len.append(l - i)
                is_bad = True
                break
            current_len += 1
        blocks_len.append(current_len if is_bad else 0)
        print(min(blocks_len))


if __name__ == '__main__':
    main()
