t = int(input())
for i in range(t):
    n = int(input())
    string = input()
    if n == 0:
        print(0)
        break
    countLeft = 0
    lastChar = "+"
    for letter in string:
        if lastChar == "+":
            lastChar = letter
        else:
            if(lastChar == ">" and letter == "<") or (lastChar == "<" and letter == "<") or (lastChar == ">" and letter == ">"):
                lastChar = letter
            else:
                countLeft +=1
       
    print(countLeft)