시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB3018952.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.

예제 입력 1

abba

예제 출력 1

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번