AmazonOA #118
Count Distinct Passwords
估计中等可在线判题
You must reverse one non-empty contiguous substring; count how many distinct strings can be obtained. A reversal of length 1 is allowed and keeps the original string.
输入格式
One line with a lowercase string of length 1..100000.
输出格式
Output a single integer answer.
样例 1
输入:
abc
输出:
4
样例 2
输入:
aaa
输出:
1
样例 3
输入:
aba
输出:
3
样例说明
Example 1: the original string, bac, acb and cba, 4 in total. Example 2: no reversal changes aaa, so the answer is 1. Example 3: the original string plus baa and aab, 3 in total.