시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 128 MB | 30 | 18 | 9 | 52.941% |
We will call two words s and t of length n palindromically equivalent, if for every pair of numbers i and j such that 1 ≤ i ≤ j ≤ n, the subword of s consisting of letters from positions i to j, inclusively, is a palindrome if and only if the subword of i consisting of letters from the same set of positions is a palindrome.
For a given word, your task is to compute the number of words over the English alphabet that are palindromically equivalent to it, modulo 109+7.
The first line of the input contains a non-empty word consisting of lowercase letters of the English alphabet, of length not exceeding 106.
Your program should output a single integer - the number of words palindromically equivalent to the one given in the input, modulo 109+7.
abba
650
Only words of the form xyyx are palindromically equivalent to abba, where x and y are distinct letters. The English alphabet contains 26 letters, consequently there are 26×25 = 650 such words in total.
Camp > POI Training Camp > ONTAK 2010 5-2번