for i in range(int(input())):
    n=input()
    s=input()
    A=[s[0]]
    for i in range(1,len(s)):
        if A[-1]=='>'and s[i]=='<':
            continue
        else:
            A.append(s[i])
    s=''.join(A)
    ans1=0
    ans2=0
    ans3=0
    ans4=0
    d=[]
    d.append(s[0])
    for i in range(1,len(s)):
        if (d[-1]=='>' and s[i]=='>') or (d[-1]=='>' and s[i]=='<') or (d[-1]=='<' and s[i]=='<'):
            d.append(s[i])
        else:
            ans1+=1
    S=[]
    for i in range(len(s)-1,0,-1):
        if s[i]=='<':
            S.append('>')
        elif s[i]=='>':
            S.append('<')
    if s[0]=='<':
        S.append('>')
    elif s[0]=='>':
        S.append('<')
    s=''.join(S)
    f=[]
    f.append(s[0])
    for i in range(1,len(s)):
        if (f[-1]=='>' and s[i]=='>') or (f[-1]=='>' and s[i]=='<') or (f[-1]=='<' and s[i]=='<'):
            f.append(s[i])
        else:
            ans2+=1
    
    

    S=[]
    for i in range(len(s)-1,0,-1):
        if s[i]=='<':
            S.append('>')
        elif s[i]=='>':
            S.append('<')
    if s[0]=='<':
        S.append('>')
    elif s[0]=='>':
        S.append('<')
    s=''.join(S)
    A=[s[0]]
    for i in range(1,len(s)):
        if A[-1]=='>'and s[i]=='<':
            continue
        else:
            A.append(s[i])
    s=''.join(A)
    d=[]
    d.append(s[0])
    for i in range(1,len(s)):
        if (d[-1]=='>' and s[i]=='>') or (d[-1]=='>' and s[i]=='<') or (d[-1]=='<' and s[i]=='<'):
            d.append(s[i])
        else:
            ans3+=1
    S=[]
    for i in range(len(s)-1,0,-1):
        if s[i]=='<':
            S.append('>')
        elif s[i]=='>':
            S.append('<')
    if s[0]=='<':
        S.append('>')
    elif s[0]=='>':
        S.append('<')
    s=''.join(S)
    f=[]
    f.append(s[0])
    for i in range(1,len(s)):
        if (f[-1]=='>' and s[i]=='>') or (f[-1]=='>' and s[i]=='<') or (f[-1]=='<' and s[i]=='<'):
            f.append(s[i])
        else:
            ans4+=1
    print(min([ans1,ans2,ans3,ans4]))