Equal Digits

길이가 1보다 큰 부분 문자열 가운데 첫 자리와 끝 자리가 같은 것들을 서로 겹치지 않게 지워, 남은 문자열이 비어 있지 않으면서 모든 자리가 서로 다른 문자열이 되는 경우의 수를 센다.

어려움8동적 계획법조합론문자열누적 합아직 제출이 없습니다시간 제한3초메모리 제한256 MB

문제

There is a string ss consisting of decimal digits.

You need to transform the string ss into any non-empty string tt in which all digits are different. To achieve the goal, you can choose and remove a set (possibly empty) of non-intersecting substrings such that the length of each substring is strictly greater than 11, and in each substring, the first digit is equal to the last one. Find the number of ways to choose such set.

Two sets are different if one of them has a substring that does not exist in the other. Substrings are different if their start or end positions differ.

Since the number of ways can be quite large, output it modulo 109+710^9 + 7.

입력

The single line contains the string ss (1s1051 \le |s| \le 10^5) consisting of decimal digits.

출력

Output one integer: the answer to the problem.