In an ICPC contest, balloons are distributed as follows:

Whenever a team solves a problem, that team gets a balloon.

The first team to solve a problem gets an additional balloon.

A contest has 26 problems, labelled $\textsf{A}$, $\textsf{B}$, $\textsf{C}$, ..., $\textsf{Z}$. You are given the order of solved problems in the contest, denoted as a string $s$, where the $i$-th character indicates that the problem $s_i$ has been solved by some team. No team will solve the same problem twice.

Determine the total number of balloons that the teams received. Note that some problems may be solved by none of the teams.


-----Input-----

The first line of the input contains an integer $t$ ($1 \leq t \leq 100$) — the number of testcases.

The first line of each test case contains an integer $n$ ($1 \leq n \leq 50$) — the length of the string.

The second line of each test case contains a string $s$ of length $n$ consisting of uppercase English letters, denoting the order of solved problems.


-----Output-----

For each test case, output a single integer — the total number of balloons that the teams received.


-----Examples-----

Input
6
3
ABA
1
A
3
ORZ
5
BAAAA
4
BKPT
10
CODEFORCES
Output
5
2
6
7
8
17


-----Note-----

In the first test case, $5$ balloons are given out:

Problem $\textsf{A}$ is solved. That team receives $2$ balloons: one because they solved the problem, an an additional one because they are the first team to solve problem $\textsf{A}$.

Problem $\textsf{B}$ is solved. That team receives $2$ balloons: one because they solved the problem, an an additional one because they are the first team to solve problem $\textsf{B}$.

Problem $\textsf{A}$ is solved. That team receives only $1$ balloon, because they solved the problem. Note that they don't get an additional balloon because they are not the first team to solve problem $\textsf{A}$.

The total number of balloons given out is $2+2+1=5$.

In the second test case, there is only one problem solved. The team who solved it receives $2$ balloons: one because they solved the problem, an an additional one because they are the first team to solve problem $\textsf{A}$.

Source: codeforces | Difficulty: EASY
Tags: Data structures

Implementation


Solutions:
def STR():
	return list(input())

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST():
	return list(map(int, input().split()))

def STRING():
	return input()
t = INT()
for tt in range(t):
	n = INT()
	s = STR()
	sm = n
	sm += len(set(s))
	print(sm)


fptr = open(0)
for _ in range(int(next(fptr))):
	n = int(next(fptr))
	s = next(fptr)[:-1]
	s1 = set(s)
	print(len(s1) * 2 + len(s) - len(s1))


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	s = list(str(input()))
	d = Counter(s)
	w = set(s)
	ans = 0
	for i in w:
		ans += 2 + d[i] - 1
	print(ans)


for _ in range(int(input())):
	n = int(input())
	s = input()
	new = []
	count = 0
	for x in s:
		if x not in new:
			new.append(x)
			count += 2
		else:
			count += 1
	print(count)


n = int(input())
for _ in range(n):
	k = int(input())
	l = list(input())
	s = set(l)
	print(2 * len(s) + k - len(s))


for x in range(int(input())):
	len_ = int(input())
	str_ = input()
	set_ = set(str_)
	count = 0
	for x in set_:
		if str_.count(x) == 1:
			count += 2
		else:
			count += 2 + str_.count(x) - 1
	print(count)


for _ in range(int(input())):
	print(int(input()) + len(set(input())))


tc = int(input())
for i in range(tc):
	n = int(input())
	s = input()
	unique = ''
	for i in s:
		if i not in unique:
			unique += i
	print(n + len(unique))


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	S = input()
	A = []
	ans = 0
	for i in S:
		if i not in A:
			ans += 2
			A.append(i)
		else:
			ans += 1
	print(ans)


for cases in range(int(input())):
	n = int(input())
	s = input()
	l = []
	k = 0
	for i in s:
		if i in l:
			k += 1
		else:
			k += 2
			l.append(i)
	print(k)


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	solved = []
	res = 0
	for i in s:
		if i not in solved:
			solved.append(i)
			res += 2
		else:
			res += 1
	print(res)


T = int(input())
for _ in range(T):
	N = int(input())
	s = input()
	balloons = set()
	ans = 0
	for x in s:
		if x in balloons:
			ans += 1
		else:
			ans += 2
		balloons.add(x)
	print(ans)


t = int(input())
for z in range(t):
	x = int(input())
	s = input()
	s = list(s)
	w = set(s)
	ans = 2 * len(w)
	ans += len(s) - len(w)
	print(ans)


for i in range(int(input())):
	n = int(input())
	s = input()
	l = len(set(s))
	l1 = len(s)
	print(2 * l + (l1 - l))


for _ in range(int(input())):
	n = int(input())
	s = input()
	ans = 0
	v = []
	for c in s:
		if c not in v:
			ans += 2
			v.append(c)
		else:
			ans += 1
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(input())
	l = []
	count = 0
	for i in a:
		if i not in l:
			l.append(i)
			count += 2
		else:
			count += 1
	print(count)


def kil_(a):
	return len(a) + len(set(a))

def kil(a):
	t = int(input())
	A = ''
	for i in range(t):
		n = input()
		A += str(kil_(a())) + '\n'
	print(A[:-1])
kil(input)


for t in range(int(input())):
	n = int(input())
	s = input()
	d = {}
	for i in s:
		if i not in d:
			d[i] = 1
		else:
			d[i] += 1
	ans = 0
	for i in d.keys():
		ans = ans + 2 + d[i] - 1
	print(ans)


def func(n, s):
	d = {}
	for elem in s:
		if elem not in d:
			d[elem] = 0
		d[elem] += 1
	return n + len(d)

def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		s = input()
		ans = func(n, s)
		print(ans)
main()


a = int(input())
for i in range(1, a + 1):
	n = int(input())
	sr = input()
	count = 0
	A = []
	for j in range(0, n):
		if sr[j] not in A:
			count = count + 2
			A.append(sr[j])
		else:
			count = count + 1
	print(count)


tc = int(input())
while tc:
	str_len = int(input())
	inp_str = input()
	inp_set = set()
	count = 0
	for item in inp_str:
		count += 1 if item in inp_set else 2
		inp_set.add(item)
	print(count)
	tc -= 1


import collections
import sys
t = int(sys.stdin.readline().rstrip())

def exec_case():
	_ = sys.stdin.readline().rstrip()
	input_: str = sys.stdin.readline().rstrip()
	num_of_problem = len(input_)
	p_list = list(input_)
	p_list_counter = collections.Counter(p_list)
	answer = num_of_problem + len(p_list_counter)
	print(answer)
for _ in range(t):
	exec_case()


n = int(input())
for _ in range(n):
	input()
	s = input()
	print(len(s) + len(set(s)))


t = int(input())
for tt in range(t):
	n = int(input())
	s = str(input())
	s1 = set(s)
	cnt = 0
	for x in s1:
		v = s.count(x)
		if v >= 2:
			cnt += v - 1
			cnt += 2
		elif v == 1:
			cnt += 2
	print(cnt)


for i in range(int(input())):
	n = input()
	s = input()
	s1 = set(s)
	c = len(s1) * 2 + (len(s) - len(s1))
	print(c)


t = int(input())
mas = []
for i in range(t):
	k = int(input())
	mas.append(input())
for st in mas:
	tup = set(st)
	res = 0
	for i in tup:
		if st.count(i) == 1:
			res += 2
		else:
			res += st.count(i) + 1
	print(res)


x = int(input())
for i in range(x):
	inpt = int(input())
	str = input()
	s = int(len(set(str)))
	print(s + inpt)


n = int(input())
i = 0
while i < n:
	k = int(input())
	s = input()
	a = ''
	j = 0
	count = 0
	while j < len(s):
		if s[j] not in a:
			a += s[j]
			count += 2
		else:
			count += 1
		j += 1
	print(count)
	i += 1


t = int(input())
for q in range(t):
	n = int(input())
	s = input()
	tally = {}
	for i in range(n):
		if s[i] not in tally.keys():
			tally[s[i]] = 1
		else:
			tally[s[i]] += 1
	counter = len(tally) + sum(tally.values())
	print(counter)


testcases = int(input())
for x in range(testcases):
	dictionary = {}
	count = 0
	lengthstring = int(input())
	thestring = input()
	for character in thestring:
		dictionary[character] = ['']
	count += len(dictionary)
	count += lengthstring
	print(count)


int_input = int(input())
for i in range(int_input):
	number = int(input())
	string = input()
	string_set = ''.join(set(string))
	print(len(string_set) * 2 + (len(string) - len(string_set)))


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	S = [x for x in s]
	c = len(set(S)) * 2
	S1 = list(set(S))
	for x in S1:
		if S.count(x) > 1:
			c += S.count(x) - 1
	print(c)


t = int(input().strip())
for _ in range(t):
	n = int(input().strip())
	s = input().strip()
	print(len(s) + len(set(s)))


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	l = list(s)
	d = set(l)
	r = len(d) * 2 + (len(l) - len(d))
	print(r)


for i in range(int(input())):
	n = int(input())
	s = input()
	count = 0
	l = []
	for i in s:
		if i not in l:
			count += 2
			l.append(i)
		else:
			count += 1
	print(count)


n = input()
for i in range(int(n)):
	m1 = input()
	m2 = input()
	ans = 0
	l = []
	for j in range(int(m1)):
		l = []
		for k in range(j):
			l.append(m2[k])
		if not m2[j] in l or l == []:
			ans += 2
		else:
			ans += 1
	print(ans)


L = []
for i in range(int(input())):
	sum = 0
	n = int(input())
	lst = list(input())
	for j in range(n):
		if j == 0:
			sum += 2
		elif lst[0:j + 1].count(lst[j]) > 1:
			sum += 1
		else:
			sum += 2
	L.append(sum)
for k in L:
	print(k)


n = int(input())
for i in range(0, n):
	lwor = int(input())
	wor = input()
	l = []
	ct = 0
	for i in range(0, len(wor)):
		if wor[i] not in l:
			ct += 2
			l.append(wor[i])
		else:
			ct += 1
	print(ct)


test = int(input())
for t in range(test):
	a = int(input())
	l = input()
	p = []
	output = 0
	for i in l:
		if i in p:
			output += 1
		else:
			output += 2
		p.append(i)
	print(output)


t = int(input())
count = []
for i in range(100):
	count.append(0)
i = 0
while t > 0:
	t = t - 1
	n = int(input())
	s = input()
	s1 = ''
	for k in range(n):
		if k == 0:
			count[i] = count[i] + 2
		elif s[k] in s1:
			count[i] = count[i] + 1
		else:
			count[i] = count[i] + 2
		s1 = s1 + s[k]
	i = i + 1
for i in range(len(count)):
	if count[i] != 0:
		print(count[i])


t = int(input())
for i in range(t):
	n = int(input())
	m = input()[:n]
	c = 0
	res = []
	l = []
	for i in m:
		if i not in res:
			res.append(i)
		else:
			l.append(i)
	print(2 * len(res) + 1 * len(l))


def getballons(st, n):
	s = set()
	ballons = 0
	for i in range(n):
		if st[i] not in s:
			s.add(st[i])
			ballons += 2
		else:
			ballons += 1
	return ballons
testcases = int(input())
while testcases > 0:
	n = int(input())
	st = input()
	print(getballons(st, n))
	testcases -= 1


for i in range(int(input())):
	l = int(input())
	s = input()
	solved = []
	b = 0
	for i in s:
		if i not in solved:
			b += 2
			solved.append(i)
		else:
			b += 1
	print(b)


for t in range(int(input())):
	n = int(input())
	s = input()
	A = []
	k = 0
	for i in s:
		if i not in A:
			k += 2
			A.append(i)
		else:
			k += 1
	print(k)


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	se = set(s)
	r = len(se) * 2
	r += n - len(se)
	print(r)


n = int(input())
l = []
for i in range(n):
	t = 2
	o = []
	k = int(input())
	s = list(str(input()))
	o = o + [s[0]]
	for j in range(1, len(s)):
		if s[j] not in o:
			o = o + [s[j]]
			t = t + 2
		else:
			t = t + 1
	l = l + [t]
for i in l:
	print(i)


n = int(input())
for i in range(n):
	s = int(input())
	st = input()
	a = []
	ans = 0
	for i in st:
		if i not in a:
			ans += 2
			a.append(i)
		else:
			ans += 1
	print(ans)


def resi():
	n = int(input())
	s = str(input())
	poseceni = [0] * 26
	iz = 0
	for i in range(n):
		if poseceni[ord(s[i]) - 65] == 0:
			poseceni[ord(s[i]) - 65] = 1
			iz += 1
		iz += 1
	print(iz)
	return
for _ in range(int(input())):
	resi()


class Tour:

	def __init__(self):
		self.ln = input()
		self.zad = input()

	def uniq(self):
		rez = []
		a = 0
		for i in range(0, len(self.zad)):
			if not self.zad[i] in rez:
				rez.append(self.zad[i])
				a = a + 2
			else:
				a = a + 1
		return a
n = input()
aa = []
for i in range(0, int(n)):
	r = Tour()
	aa.append(r.uniq())
for i in range(0, len(aa)):
	print(aa[i])


t = int(input())
while t > 0:
	n = int(input())
	s = input()
	balloons = 0
	solved = set()
	for problem in s:
		if problem not in solved:
			solved.add(problem)
			balloons += 2
		else:
			balloons += 1
	print(balloons)
	t -= 1


def func(s):
	save = set()
	res = 0
	for i in s:
		if i not in save:
			res += 2
			save.add(i)
		else:
			res += 1
	return res
t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	print(func(s))


for t in range(int(input())):
	n = int(input())
	a = list(input())
	were = []
	c = 0
	while a:
		were.append(a.pop(0))
		if were[-1] in were[:-1]:
			c += 1
		else:
			c += 2
	print(c)


MOD = 10 ** 9 + 7
fac_mem = [1]

def fac(n):
	while len(fac_mem) < n + 1:
		fac_mem.append(fac_mem[-1] * len(fac_mem) % MOD)
	return fac_mem[n]

def perm(n, k):
	return fac(n) * pow(fac(k), MOD - 2, MOD) % MOD

def comb(n, k):
	return fac(n) * pow(fac(k) * fac(n - k) % MOD, MOD - 2, MOD) % MOD

def count(l):
	r = {}
	for i in l:
		r[i] = r.get(i, 0) + 1
	return r

def group(l):
	r = []
	p = None
	c = 0
	for i in l:
		if i == p:
			c += 1
		else:
			r.append((p, c))
			p = i
			c = 1
	if c:
		r.append((p, c))
	return r

class Tree:

	def __init__(self, id):
		self.id = id
		self.parent = None
		self.children = []

	def __repr__(self):
		if self.children:
			return f'{self.id} -> [' + ', '.join((str(c) for c in self.children)) + ']'
		else:
			return f'{self.id}'
for case in range(int(input())):
	(n,) = [int(j) for j in input().split()]
	s = input()
	print(n + len(set(list(s))))


t = int(input())
for tt in range(t):
	n = int(input())
	print(n + len(set(input())))


for _ in range(int(input())):
	n = int(input())
	l = [0] * 26
	s = input()
	for i in s:
		l[ord(i) - ord('A')] += 1
	ans = 0
	for i in l:
		if i != 0:
			ans += i + 1
	print(ans)


for _ in range(int(input())):
	n = int(input())
	s = set()
	cnt = 0
	for x in input():
		if x not in s:
			cnt += 1
			s.add(x)
		cnt += 1
	print(cnt)


for i in range(int(input())):
	n = int(input())
	f = input()
	print(len(set(list(f))) + len(f))


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	d = dict()
	for i in range(len(s)):
		if s[i] not in d:
			d[s[i]] = 2
		else:
			d[s[i]] += 1
	print(sum(d.values()))


import sys
from collections import defaultdict
input = lambda : sys.stdin.readline().strip()
lis = lambda : list(map(int, input().split()))
sin = lambda : int(input())
many = lambda : map(int, input().split())

def solve():
	n = sin()
	s = input()
	d = {}
	for i in s:
		if i in d:
			d[i] += 1
		else:
			d[i] = 1
	ans = 0
	for i in d:
		if d[i] > 0:
			ans += 2 + (d[i] - 1)
	print(ans)
testisisisisisis = int(input())
for testis in range(testisisisisisis):
	solve()


for _ in range(int(input())):
	n = int(input())
	s = list(input())
	ans = 0
	t = set()
	for i in range(n):
		if s[i] in t:
			ans += 1
		else:
			ans += 2
			t.add(s[i])
	print(ans)


for _ in range(int(input())):
	n = int(input())
	s = input()
	val = [0 for _ in range(26)]
	ans = 0
	for i in s:
		if val[ord(i) - 65] == 0:
			ans += 2
			val[ord(i) - 65] = 1
		else:
			ans += 1
	print(ans)


for _ in range(int(input())):
	n = int(input())
	g = {}
	c = 0
	for i in input():
		if i in g:
			g[i] += 1
			c += 1
		else:
			g[i] = 2
			c += 2
	print(c)


t = int(input())
sum = 0
while t:
	t -= 1
	n = int(input())
	s = input()
	l = []
	for i in s:
		l.append(i)
	l2 = list(set(l))
	print(len(l2) * 2 - len(l2) + len(l))


t = int(input())
for tc in range(t):
	n = int(input())
	s = input()
	seen = []
	ans = 0
	for char in s:
		if char not in seen:
			seen.append(char)
			ans += 2
		else:
			ans += 1
	print(ans)


for x in range(int(input())):
	n = int(input())
	s = input()
	print(n + len(set(s)))


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	suma = 0
	for i in range(len(s)):
		s1 = s[:i + 1]
		if s1.count(s[i]) == 1:
			suma += 2
		else:
			suma += 1
	print(suma)


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	visited = set()
	ans = 0
	for char in s:
		if char not in visited:
			ans += 1
		ans += 1
		visited.add(char)
	print(ans)


import math
import copy
t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	data = {}
	for x in range(26):
		data[chr(x + ord('A'))] = 0
	ballon = 0
	for c in s:
		if data[c] == 0:
			ballon += 2
			data[c] = 1
		else:
			ballon += 1
	print(ballon)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	s = input().rstrip()
	used = set()
	pre = ''
	answer = 0
	for v in s:
		if v not in used:
			used.add(v)
			answer += 2
		else:
			answer += 1
	print(answer)


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	st = set()
	for i in s:
		st.add(i)
	print(n + len(st))


for i in range(int(input())):
	n = int(input())
	s = input()
	print(len(set(s)) + n)


t = int(input())
while t > 0:
	n = int(input())
	s = input()
	l = []
	points = 0
	for i in s:
		if i not in l:
			points += 2
			l.append(i)
		elif i in l:
			points += 1
	print(points)
	t -= 1


t = int(input())
for i in range(t):
	n = int(input())
	a = input()
	f = set()
	s = 0
	for i in a:
		if i not in f:
			s += 2
		else:
			s += 1
		f.add(i)
	print(s)


n = int(input())
for x in range(n):
	length = int(input())
	string = input()
	tmp = len(list(set(list(string))))
	print(tmp * 2 + (length - tmp))


import sys
input = lambda : sys.stdin.readline().rstrip()
inpnm = lambda : map(int, input().split())
inparr = lambda : [int(i) for i in input().split()]
inpint = lambda : int(input())
for case in range(int(input())):
	n = inpint()
	s = input()
	arr = set(s)
	print(n + len(arr))


for _ in range(int(input())):
	n = int(input())
	s = input()
	cnt = 0
	visited = set()
	for i in s:
		if i not in visited:
			cnt += 2
			visited.add(i)
		else:
			cnt += 1
	print(cnt)


for t in range(int(input())):
	n = int(input())
	A = input()
	k = len(set(A))
	print(k * 2 + (n - k))


import sys
T = int(sys.stdin.readline())
for t in range(T):
	n = int(sys.stdin.readline())
	s = sys.stdin.readline().rstrip()
	check = [False for _ in range(26)]
	score = 0
	for ch in s:
		if check[ord(ch) - ord('A')]:
			score += 1
		else:
			score += 2
			check[ord(ch) - ord('A')] = True
	print(score)


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	check = set()
	ans = 0
	for i in input().strip():
		if i not in check:
			ans += 2
			check.add(i)
		else:
			ans += 1
	print(ans)


import sys
import collections
from math import ceil, gcd, sqrt, log
import bisect
INF = float('inf')
mod = 1000000007

def solve():
	n = int(input())
	s = input()
	ok = collections.defaultdict(int)
	ans = 0
	for i in s:
		if ok[i] > 0:
			ans += 1
		else:
			ans += 2
		ok[i] += 1
	print(ans)
t = int(input())
while t != 0:
	solve()
	t -= 1


t = int(input())
for eh in range(t):
	a = input()
	em = input()
	first = ''
	x = 0
	for i in em:
		if not i in first:
			first += i
			x += 2
		else:
			x += 1
	print(x)


t = int(input())
while t:
	n = int(input())
	s = input()
	hash = {c: 0 for c in s}
	total = 0
	for c in s:
		if hash[c] == 0:
			total += 2
		else:
			total += 1
		hash[c] += 1
	print(total)
	t -= 1


t = int(input())
for i in range(t):
	input()
	k = ''
	s = input()
	cnt = 0
	for i in s:
		if k.count(i) == 0:
			cnt += 2
			k += i
		else:
			cnt += 1
	print(cnt)


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	a = []
	c = 0
	for i in range(n):
		if s[i] not in a:
			a.append(s[i])
			c += 2
		else:
			c += 1
	print(c)


t = int(input())
for _ in range(t):
	n = input()
	s = input()
	dic = {}
	ans = 0
	for i in s:
		if dic.get(i, 0):
			ans += 1
		else:
			ans += 2
			dic[i] = 1
	print(ans)


for _ in range(int(input())):
	n = int(input())
	s = input()
	li = []
	ctr = 0
	for i in s:
		if i in li:
			ctr += 1
		else:
			ctr += 2
			li.append(i)
	print(ctr)


def sol():
	n = int(input())
	s = input()
	s_ = set()
	score = 0
	for i in s:
		if i in s_:
			score += 1
		else:
			s_.add(i)
			score += 2
	print(score)
for _ in range(int(input())):
	sol()


def solve():
	n = int(input())
	s = str(input())
	a = []
	count = 0
	for i in range(n):
		if s[i] not in a:
			count += 2
			a.append(s[i])
		else:
			count += 1
	print(count)
t = int(input())
for i in range(t):
	solve()


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	a = list(map(str, s))
	b = list(set(a))
	ballon = len(b) * 2 + (len(a) - len(b))
	print(ballon)


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	d = {}
	ball = 0
	for i in s:
		if i in d:
			d[i] += 1
		else:
			d[i] = 1
	for i in d:
		ball += d[i] + 1
	print(ball)


t = int(input())
for caso in range(t):
	n = int(input())
	s = input()
	dic = []
	punct = 0
	for letra in s:
		if letra not in dic:
			dic.append(letra)
			punct += 2
		else:
			punct += 1
	print(punct)


alph = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
for _ in range(int(input())):
	ans = 0
	n = int(input())
	s = input()
	used = []
	for el in s:
		if el not in used:
			ans += 2
			used.append(el)
		else:
			ans += 1
	print(ans)


t = int(input())
for u in range(t):
	n = int(input())
	g = input()
	L = []
	for j in range(n):
		L.append(g[j])
	i = 0
	for h in range(n):
		if L.count(h) == 1:
			i += 1
		elif L.index(L[h]) == h:
			i += 2
		elif L.index(L[h]) < h:
			i += 1
	print(i)


t = int(input())
while t:
	n = int(input())
	s = input()
	ans = 0
	l = [s[i] for i in range(n)]
	l.sort()
	for i in range(1, n):
		if l[i] == l[i - 1]:
			ans += 1
		else:
			ans += 2
	print(ans + 2)
	t = t - 1


n = int(input())
for i in range(n):
	x = int(input())
	st = input()
	print(x + len(set(st)))


tests = int(input())
for _ in range(tests):
	n = int(input())
	line = input()
	d = {}
	for char in line:
		if char not in d:
			d[char] = 0
		d[char] += 1
	total = 0
	for score in d.values():
		total += score + 1
	print(total)