#jag2018summerday2h. [jag2018summer_day2_h]Prefix Suffix Free
[jag2018summer_day2_h]Prefix Suffix Free
Problem Statement
You are given a string consisting of lowercase English letters. Count the number of strings that satisfies all of the following conditions:
- is a string of the same length as , consisting of lowercase English letters.
- For all ( ), the string formed by the first letters of does not coincide with the string formed by the last letters of .
Since the answer can be very large, find the number modulo .
Constraints
- consists of lowercase English letters.
Input
Input is given from Standard Input in the following format:
Output
Print the number of strings that satisfy the condition, modulo .
Sample Input 1
aa
Sample Output 1
650
For example, zz
and ab
satisfy the condition, but ba
or aa
does not.
Sample Input 2
abc
Sample Output 2
16873
Sample Input 3
xrxbaxrxikxrxgvcpuwx
Sample Output 3
352084595