AmazonOA #186
Find Password Strength
估计困难可在线判题
For every non-empty contiguous substring, count its distinct characters, then add up the counts of the substrings at all positions. The source's aa example left out aa itself; this site corrects it to 3 and does not adopt the "number of characters that appear exactly once" definition.
输入格式
One line containing a lowercase password string. This site uses length 1..100000.
输出格式
Output a single integer, the answer.
样例 1
输入:
good
输出:
16
样例 2
输入:
aa
输出:
3
样例 3
输入:
abc
输出:
10
样例说明
The answers are 16, 3 and 10.