All submissions for this problem are available.
Hacker Aiden Pearce wants to access the CTOS security system.
The system is protected by a firewall which consists of many layers. The firewall is represented by a string ‘S’ . Each layer of firewall is represented by a string S’ which belongs to S.
Since the system is much secured there are as many layers as possible but each layer is distinct.
Now, to break into the system, hacker has to program worms to destroy firewall. Now a worm is programmed to destroy only a single layer.
You are required to determine the number of worms required to break the firewall.
First line of input gives 'T' the number of test cases.
Each test case contains a string 'S'.
For each test case print the number of worms that need to be programmed.
- 1 ≤ T ≤ 1000
- 1 ≤ |S| ≤ 100
Input: 3 abc aba aaa Output: 6 5 3
Example case 1 : In the first case there are 6 possible layers 'a','b','c','ab','bc','abc'
Example case 3 : In the first case there are 3 possible layers 'a','aa','aaa'
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, RUBY, PHP, NODEJS, SCALA, PERL, BASH, PERL6|
Fetching successful submissions