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

12043번 - Lazy Spelling Bee (Large) 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
5 초 512 MB25016212660.870%

문제

In the Lazy Spelling Bee, a contestant is given a target word W to spell. The contestant's answer word A is acceptable if it is the same length as the target word, and the i-th letter of A is either the i-th, (i-1)th, or (i+1)th letter of W, for all i in the range of the length of A. (The first letter of A must match either the first or second letter of W, since the 0th letter of W doesn't exist. Similarly, the last letter of A must match either the last or next-to-last letter of W.) Note that the target word itself is always an acceptable answer word.

You are preparing a Lazy Spelling Bee, and you have been asked to determine, for each target word, how many distinct acceptable answer words there are. Since this number may be very large, please output it modulo 1000000007 (109 + 7).

입력

The first line of the input gives the number of test cases, T. T test cases follow; each consists of one line with a string consisting only of lowercase English letters (a through z).

Limits

  • 1 ≤ T ≤ 100.
  • 1 ≤ length of each string ≤ 1000.

출력

For each test case, output one line containing "Case #x: y", where x is the test case number (starting from 1) and y is the number of distinct acceptable answer words, modulo 109 + 7.

제한

예제 입력 1

4
ag
aa
abcde
x

예제 출력 1

Case #1: 4
Case #2: 1
Case #3: 108
Case #4: 1

힌트

In sample case #1, the acceptable answer words are aa, ag, ga, and gg.

In sample case #2, the only acceptable answer word is aa.

출처

Contest > Google > Google's Coding Competitions > Google APAC 2017 University Test > Practice Round APAC test 2017 A2번

Contest > Google > Google's Coding Competitions > Google APAC 2016 University Graduates Test > Round E APAC Test 2016 A2번

Contest > Google > Kick Start > Google Kick Start 2015 > Round E A2번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

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

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