for _ in range(int(input())):
	n = int(input())
	s = input()
	stack = []
	for ch in s:
		if (len(stack)):
			if ch=='<':
				if stack[0]=='>':
					stack.pop()
				else:
					stack.append(ch)
			else:
				stack.append(ch)
		else:
			stack.append(ch)
	print(max(0, len(stack)-1))