#region Header
#!/usr/bin/env python3
# from typing import *

import sys
import io
import math
import collections
import decimal
import itertools
import bisect
import heapq

def input():
    return sys.stdin.readline()[:-1]

sys.setrecursionlimit(1000000)
#endregion

_INPUT = """1
100
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
"""
sys.stdin = io.StringIO(_INPUT)

def f(L):
    # > に統一
    n = 0
    power = 0
    for i in range(0, len(L), 2):
        power += L[i]
        n += max(L[i+1] - power, 0)
    return n

def main():
    N0 = int(input())
    for _ in range(N0):
        N = int(input())
        S = input()
        L = []
        i0 = 0
        for i in range(N):
            if S[i] != S[i0]:
                L.append(i - i0)
                i0 = i
        L.append(i - i0 + 1)

        if S[0] == '<' and S[-1] == '>':
            a = min(L[0], L[-1])
            print(a)
        else:
            print(0)
        continue








        # >..>, <..< にする
        if S[0] == '<':
            L = [0] + L
        if S[-1] == '>':
            L = L + [0]

        # > に統一
        n1 = f(L)

        # < に統一
        n2 = f(list(reversed(L)))

        print(min(n1, n2))

if __name__ == '__main__':
    main()
