Logo
(追記) (追記ここまで)

19020번 - Decomposition 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 512 MB36111029.412%

문제

You are given a string $S$. You want to partition it into several (possibly one) nonempty substrings. There are 2ドル^{|S|-1}$ ways of partitions. For example, aba, ab+a, a+ba, a+b+a are all the partitions of the string aba.

We define the weight of a substring $T$ as the length of the shortest string $x$ such that $T = x x \ldots x$. For example, the weight of aaa is 1ドル,ドル and the weight of ab is 2ドル$. We define the weight of a partition as the product of the weights of all substrings in this partition.

Output the sum of weights of all partitions. The answer can be large, so output the answer modulo 10ドル^9 + 7$.

입력

The first line contains an integer $T$ (1ドル \leq T \leq 10^5$) indicating the number of test cases.

Each test case is given on a separate one line containing a string $S$ (1ドル \leq |S| \leq 2 \cdot 10^5$) consisting of lowercase English letters.

It is guaranteed that $\sum |S| \leq 10^6$.

출력

For each test case, output the answer modulo 10ドル^9 + 7$.

제한

예제 입력 1

1
abaababaabbbaabbbb

예제 출력 1

5320053

힌트

출처

Camp > Petrozavodsk Programming Camp > Summer 2018 > Day 8: Yuhao Du Contest 5, Grand Prix of Zhejiang D번

Contest > Open Cup > 2018/2019 Season > Stage 1: Grand Prix of Zheijang D번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /