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

28153번 - Repetitive String Invention 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 2048 MB75343350.000%

문제

Lulu has a string consisting of lowercase English letters. She would like to make her string Repetitive. A repetitive string has an even number of characters, and the first half of the string exactly matches the second half of the string. For example, "lulu", "abcabc" and "xx" are repetitive strings, while "xyx" and "abac" are not.

To get a repetitive string, Lulu can take two non-overlapping, non-empty substrings from her string and concatenate them together. The substrings must be concatenated in the order that they appear in her string.

She's wondering, what is the number of ways she can choose two substrings to make a repetitive string? Two ways are different if at least one of the substrings Lulu uses comes from a different part of her string.

Consider the string "aaaa".

  • There are six ways for Lulu to form the repetitive string "aa": by matching each "a" with each subsequent "a" (1ドル$+2ドル,ドル 1ドル$+3ドル,ドル 1ドル$+4ドル,ドル 2ドル$+3ドル,ドル 2ドル$+4ドル,ドル 3ドル$+4ドル$).
  • There are also three ways for her to form "aaaa": "a"+"aaa", "aa"+"aa" and "aaa"+"a".

So there are nine ways for Lulu to form a repetitive string by concatenating non-overlapping, non-empty substrings of "aaaa" in order.

입력

The single line of input contains a single string $s$ (1ドル \le |s| \le 800, s \in \{a-z\}^*$). This is Lulu's string.

출력

Output a single integer, which is the number of ways Lulu can concatenate two non-overlapping, non-empty substrings from her string in order to get a repetitive string.

제한

예제 입력 1

aaaa

예제 출력 1

9

예제 입력 2

axabxbcxcdxd

예제 출력 2

22

힌트

출처

ICPC > Regionals > North America > North America Championship > North America Championship 2023 J번

  • 문제를 만든 사람: Lewin Gan
(追記) (追記ここまで)

출처

대학교 대회

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

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