Aditya's Love for Strings

2.7

3 votes
String Algorithms, Easy
Problem

Aditya is a professor in Engilsh loves to play with words. Today he asks his assistant Abishek to perform an experiment where he wants him to calculate the total number of word that can be formed from a given word such that the characters are arranged lexicographically(in alphabetical order). The words that are to be formed can start with any of the alphabets present in the word and the generated word cannot contain a single alphabet twice given by the professor.

Abishek visit you as their professor for Computer Science to help them by writing a code that would calculate the same.

INPUT:

First line contains the no of test cases, N<1000 Next N lines contains Strings of length L<1000000

OUTPUT:

N Lines containing the no of words formed in each test case

Time Limit: 5
Memory Limit: 256
Source Limit:
Explanation

For 1st String ankit

The words Formed are:

aiknt iknt knt nt t

For aman

amn mn n

Editor Image

?