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

6908번 - Substrings 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB30201872.000%

문제

How many distinct substrings does a given string $S$ have?

For example, if $S =$ abc, $S$ has 7ドル$ distinct substrings: , a, b, c, ab, bc, abc. Note that the empty string and $S$ itself are considered substrings of $S$.

On the other hand, if $S =$ aaa. $S$ has only 4ドル$ distinct substrings: , a, aa, aaa.

입력

The first line of the input file contains $N,ドル the number of test cases. For each test case, a line follows giving $S,ドル a string of from 1ドル$ to 5000ドル$ alphanumeric characters.

출력

Your output consists of one line per case, giving the number of distinct substrings of $S$.

제한

50% of test cases will have $l$ (the length of the string) where $l \le 1000$. For all cases, $l \le 5000$.

예제 입력 1

2
abc
aaa

예제 출력 1

7
4

힌트

출처

Olympiad > Canadian Computing Competition & Olympiad > 2003 > CCC 2003 Senior Division 4번

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

출처

대학교 대회

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

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