Mishra has gone bizarre these days. And therefore loves only bizzare patterns. Nowadays he has ran into a habit of not listening to many "yes" or "no" from people like Bansal. In fact he does not like strings having more than one "yes" or one "no" consecutively. Bansal sends him a string of length L containing only 'Y' or 'N' for "yes" or "no" respectively. Mishra has designed a technique to convert the string into string of his liking. He picks up any two same consecutive characters and turns them into any of "YY", "YN", "NY" or "NN". Each such conversion costs Mishra one unit of energy. Help Mishra to find the conversion which costs least amount of energy or output -1 if Mishra could not perform the conversion.

Input :
            First line contains a integer T, denoting the number of test cases.
            Each test case consists of two lines.
            First line of each test case contains a single integer L representing the length of string sent by Bansal.
            Second line of each test case contains a string of L characters, each character being either 'Y' or 'N'.

Output :
            For each test case output a single integer representing the minimum energy required for conversion or output -1 if the conversion is not possible.

Constraints :
            1 ≤ T ≤ 100
            1 ≤ L ≤ 10000SAMPLE INPUT
3
2
YY
2
YN
5
YYNNY

SAMPLE OUTPUT
1
0
2
#!/usr/bin/python
"""
HackerEarth practice problem
(http://www.hackerearth.com/problem/algorithm/bizzare-mishra/)
@date 2014/2/25
"""

import fileinput

input = []
output = 0
map = {'N':'Y','Y':'N'}
for line in fileinput.input():
	input.append(line)
case_count = int(input[0])
for i in range(case_count):
	len = int(input[i*2+1])
	str = input[i*2+2].strip()
	count1 = 0
	count2 = 0
	char1 = 'Y'
	char2 = 'N'
	for j in range(0, len):
		if str[j] == char1:
			count1 += 1
			char1 = map[char1]
		else:
			char1 = str[j]
		if str[j] == char2:
			count2 += 1
			char2 = map[char2]
		else:
			char2 = str[j]
	if count1 < count2:
		print(count1)
	else:
		print(count2)