You have initially a string of N characters, denoted by A1,A2...AN. You have to print the size of the largest subsequence of string A such that all the characters in that subsequence are distinct ie. no two characters in that subsequence should be same.

A subsequence of string A is a sequence that can be derived from A by deleting some elements  and without changing the order of the remaining elements.

-----Input-----
First line contains T, number of testcases. Each testcase consists of a single string in one line. Each character of the string will be a small alphabet(ie. 'a' to 'z').

-----Output-----
For each testcase, print the required answer in one line.

-----Constraints-----
- 1 ≤ T ≤ 10
- Subtask 1 (20 points):1 ≤ N ≤ 10
- Subtask 2 (80 points):1 ≤ N ≤ 105

-----Example-----
Input:
2
abc
aba

Output:
3
2

-----Explanation-----
For first testcase, the whole string is a subsequence which has all distinct characters.

In second testcase, the we can delete last or first 'a' to get the required subsequence.

Difficulty: EASY
Tags: String algorithms

Data structures
Skill types: Data structures

Starter code:

Solutions:
for _ in range(int(input())):
	s = input()
	s = list(s)
	print(len(set(s)))


for i in range(int(input())):
	string = input()
	print(len(set(string)))


from sys import stdin as sin

def aint():
	return int(input())

def amap():
	return map(int, sin.readline().split())

def alist():
	return list(map(int, sin.readline().split()))

def astr():
	return input()
for _ in range(int(input())):
	s = input()
	f = [0] * 26
	m = 0
	for i in range(len(s)):
		if not f[ord(s[i]) - 97]:
			m += 1
			f[ord(s[i]) - 97] = 1
	print(m)


for _ in range(int(input())):
	n = [a for a in input()]
	s = list(set(n))
	print(len(s))


t = int(input())
for _ in range(t):
	n = input()
	l1 = []
	for i in n:
		if i not in l1:
			l1.append(i)
	print(len(l1))


for i in range(int(input())):
	l = list(map(str, input()))
	a = set(l)
	print(len(a))


for i in range(int(input())):
	s = input()
	temp = []
	unique = 0
	for i in range(len(s)):
		if s[i] not in temp:
			unique += 1
		temp.append(s[i])
	print(unique)


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


for i in range(int(input())):
	l = list(input())
	s = list(set(l))
	print(len(s))


t = int(input())
for _ in range(t):
	s = input()
	lis = list(s)
	print(len(set(lis)))


t = int(input())
for i in range(t):
	s = input()
	print(len(set(list(s))))


for _ in range(int(input())):
	s = input()
	s = list(dict.fromkeys(s))
	print(len(s))


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


from collections import Counter
for x in range(int(input())):
	a = input()
	dictt = Counter(a)
	print(len(dictt))


n = int(input())
for i in range(n):
	x = input()
	t = []
	for i in x:
		if i not in t:
			t.append(i)
	print(len(t))


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


for i in range(int(input())):
	p = input()
	print(len(set(p)))


for _ in range(int(input())):
	s = input()
	a = set()
	for i in s:
		a.add(i)
	print(len(a))


from collections import Counter, UserString
from math import log2
mod = lambda n: int(n % (10 ** 9 + 7))
_fc = [1]
for i in range(1, 1000001):
	_fc.append(i * _fc[i - 1])
	_fc[i] = mod(_fc[i])

def fact(n):
	if -1000001 < n < 1000001:
		if n > -1:
			return _fc[n]
		else:
			return int('-' + str(_fc[abs(n)]))
	else:
		raise ValueError('values only from 1000000 to -1000000 can be factorialized\n')

def yn(b, caps=False, y='Yes', n='No'):
	if b:
		returning = y
	else:
		returning = n
	if caps == 2:
		return returning.lower()
	elif caps:
		return returning.upper()
	return returning

def prob(l, n):
	return l.count(n) / len(l)

def isSubseq(s1, s2):
	(n, m) = (len(s1), len(s2))
	(i, j) = (0, 0)
	while i < n and j < m:
		if s1[i] == s2[j]:
			i += 1
		j += 1
	return i == n

def isPrime(n):
	if n > 1:
		for i in range(2, int(n ** 0.5) + 1):
			if not n % i:
				return False
		else:
			return True
	return True

def percentDiff(n, diff):
	return n + n * (diff / 100)

def prodLst(l1, nl):
	if isinstance(nl, int):
		return [i * nl for i in l1]
	else:
		return [i * j for (i, j) in zip(l1, nl)]

def divLst(l1, nl, mxMn=False):
	if isinstance(nl, int):
		return [i // nl for i in l1]
	elif mxMn:
		return [max(i, j) // min(i, j) for (i, j) in zip(l1, nl)]
	else:
		return [i // j for (i, j) in zip(l1, nl)]

def modLst(l, n):
	return [i % n for i in l]

def sumLst(l1, nl):
	if isinstance(nl, int):
		return [i + nl for i in l1]
	else:
		return [i + j for (i, j) in zip(l1, nl)]

def absLst(l):
	return [abs(i) for i in l]

def diffLst(l1, nl, isAbs=False):
	if isinstance(nl, int):
		returning = [i - nl for i in l1]
	else:
		returning = [i - j for (i, j) in zip(l1, nl)]
	if isAbs:
		return absLst(returning)
	else:
		return returning

def remCommonOccurs(l, remLst):
	srl = set(remLst)
	returning = []
	for i in l:
		if i not in remLst:
			returning.append(i)
	return returning

def remPosNeg(l, posNeg=False):
	returning = []
	if not posNeg:
		for i in l:
			if i >= 0:
				returning.append(i)
	else:
		for i in l:
			if i < 0:
				returning.append(i)
	return returning

def flip(nl):
	if isinstance(nl, int):
		return -nl
	elif isinstance(nl, list):
		return [-i for i in nl]

def ev(n):
	return not n & 1

def decimal(n):
	return round(n + 0.5)

def printabs(n):
	print(abs(n))

def printm(n):
	print(mod(n))

def printy(b, caps=False, y='Yes', n='No'):
	print(yn(b, caps, y, n))

class mutableStr(UserString):

	def ins(self, n, s):
		if n < 0:
			self.data = self.data = ''.join(list(self.data)[:n + 1]) + s + ''.join(list(self.data)[n + 1:])
		else:
			self.data = ''.join(list(self.data)[:n]) + s + ''.join(list(self.data)[n:])

	def rem(self, s):
		self.data = self.data.replace(s, '')
alphabetOrd = [97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122]
alphabet = list('abcdefghijklmnopqrstuvwxyz')
bint = lambda b: int(b, 2)
r2 = lambda n: range(1, n + 1)
rl = lambda *l: range(len(l[0])) if len(l) == 1 else range(l[0], len(l[1]))
alph = lambda s: s.isalpha()
sl = lambda l: list(set(l))
inf = float('inf')
soi = lambda : sorted(input())
ii = lambda : int(input())
li = lambda : list(map(int, input().split()))
si = lambda : mutableStr(str(input()))
lsi = lambda : list(input())
sepi = lambda : map(int, input().split())
seti = lambda : set(map(int, input().split()))
for t in range(int(input())):
	inpStr = sl(si())
	print(len(inpStr))


t = int(input())
for _ in range(t):
	arr = input()
	lis = []
	for ele in arr:
		if ele not in lis:
			lis.append(ele)
	print(len(lis))


from collections import Counter as c
for _ in range(int(input())):
	a = input()
	print(len(set(a)))


t = int(input())
for ni in range(t):
	s = input()
	l = set(list(s))
	print(len(l))


t = int(input())
while t > 0:
	s = input()
	dict1 = {}
	op = ''
	for i in range(len(s)):
		if s[i] not in dict1:
			dict1[s[i]] = 1
			op += s[i]
	print(len(op))
	t = t - 1


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


from math import *
import sys

def input():
	return sys.stdin.readline().replace('\n', '').strip()
sys.setrecursionlimit(10 ** 9)
for _ in range(int(input())):
	l = list(input())
	print(len(set(l)))


try:
	t = int(input())
	for w in range(t):
		s = str(input())
		k = list(s)
		q = []
		for i in range(0, len(k)):
			if k[i] in k:
				if k[i] not in q:
					q.append(k[i])
		print(len(q))
except EOFError as e:
	pass


testcases = int(input())
for i in range(testcases):
	arr = list(input())
	print(len(set(arr)))


T = int(input())
for i in range(T):
	s = input()
	set1 = set(s)
	print(len(set1))


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


t = int(input())
for i in range(t):
	s = input()
	st = ''
	for j in range(len(s)):
		if s[j] not in st:
			st += s[j]
	print(len(st))


for _ in range(int(input())):
	s = input()
	arr = []
	for i in range(len(s)):
		if s[i] in arr:
			pass
		else:
			arr.append(s[i])
	print(len(arr))


for _ in range(int(input())):
	S = input().strip()
	print(len(set(S)))


t = int(input())
for i in range(t):
	s = input()
	p = set(s)
	print(len(p))


T = int(input())
for t in range(T):
	my_str = input()
	unique_list = []
	for ch in my_str:
		if ch not in unique_list:
			unique_list.append(ch)
	print(len(unique_list))


for t in range(int(input())):
	k = list(input())
	m = set(k)
	print(len(m))


t = int(input())
for i in range(t):
	s = input()
	t = ''
	for char in s:
		if char not in t:
			t += char
	print(len(t))


for t in range(int(input())):
	print(len(set(input())))


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


for _ in range(int(input())):
	N = input()
	l = []
	for i in N:
		if i in l:
			pass
		else:
			l.append(i)
	print(len(l))


t = int(input())
for i in range(t):
	a = input()
	print(len(set(a)))


T = int(input())
for _ in range(0, T):
	s = set(str(input()))
	print(len(s))


t = int(input())
for i in range(t):
	s = input()
	l = []
	for i in s:
		if i not in l:
			l.append(i)
	print(len(l))


from math import ceil
for _ in range(int(input())):
	a = list(input())
	print(len(set(a)))


T = int(input())
for i in range(T):
	s = input()
	ans = ''
	for i in s:
		if i not in ans:
			ans += i
	print(len(ans))


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


for test in range(int(input())):
	longest_distint_set = set(input())
	print(len(longest_distint_set))


t = int(input())
while t:
	t -= 1
	s = input()
	print(len(set(s)))


for _ in range(int(input())):
	l = list(input())
	l2 = []
	for i in l:
		if i not in l2:
			l2.append(i)
	print(len(l2))


T = int(input())
ans = []
for _ in range(T):
	A = input()
	ans.append(len(set(list(A))))
for i in ans:
	print(i)


testcases = int(input())
while testcases > 0:
	testcases = testcases - 1
	s = input()
	d = dict()
	for i in range(0, len(s)):
		if s[i] in d:
			d[s[i]] += 1
		else:
			d[s[i]] = 1
	print(len(d))


T = int(input())
for i in range(0, T):
	s = str(input())
	l = list(s)
	l = [*set(l)]
	print(len(l))


import numpy as np
t = int(input())
for _ in range(t):
	s = input()
	l = list(s)
	a = np.array(l)
	print(np.unique(a).size)


for i in range(int(input())):
	x = input()
	print(len(set([i for i in x])))


for _ in range(int(input())):
	s = input()
	if len(s) == len(set(s)):
		print(len(s))
	else:
		s1 = ''
		for e in s:
			if e not in s1:
				s1 += e
		print(len(s1))


def solve(S):
	a = set(S)
	return len(a)
t = int(input())
for _ in range(t):
	s = input()
	print(solve(s))


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
from collections import defaultdict
for _ in range(int(input())):
	wi(len(set(rs())))


for i in range(int(input())):
	string = input()
	count = 0
	l_st = []
	for i in range(len(string)):
		if string[i] not in l_st:
			l_st.append(string[i])
			count += 1
	print(count)


t = int(input())
for itr in range(t):
	s = input()
	print(len(set(s)))


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


t = int(input())
for i in range(t):
	a = str(input())
	print(len(set(list(a))))


from sys import stdin as sin

def aint():
	return int(input())

def amap():
	return map(int, sin.readline().split())

def alist():
	return list(map(int, sin.readline().split()))

def astr():
	return input()
for _ in range(int(input())):
	s = input()
	print(len(set(s)))


testcase = int(input())
for i in range(testcase):
	lst = list(input())
	print(len(set(lst)))


t = int(input())
for tc in range(t):
	s = input()
	a = []
	for i in range(len(s)):
		a.append(s[i])
	b = set(a)
	print(len(b))


for _ in range(int(input())):
	s = input()
	x = []
	for i in s:
		if i not in x:
			x.append(i)
	print(len(x))


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


t = int(input())
for i in range(t):
	s = input()
	s1 = set()
	for j in s:
		s1.add(j)
	print(len(s1))


a = int(input())
for i in range(a):
	b = input()
	c = set(b)
	d = len(c)
	print(d)


from collections import Counter
t = int(input())
for i in range(t):
	a = input()
	print(len(set(a)))


for tc in range(int(input())):
	a = input()
	print(len(set(a)))


t = 0
try:
	t = int(input())
except:
	pass
for _ in range(t):
	a = input()
	print(len(set(a)))


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


t = input()
for c in range(0, int(t)):
	b = input()
	c = set(b)
	d = len(c)
	print(d)


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


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


t = int(input())
for i in range(0, t):
	s = input()
	print(len(set(s)))


k = int(input())
for i in range(k):
	print(len(set(list(input()))))


for _ in range(int(input())):
	s = input()
	st = ''
	for i in s:
		if i not in st:
			st += i
	print(len(st))