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

23135번 - Magic Box 다국어

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

문제

Rikka recently got a magic box. The box has $n$ squares arranged in a row, and there is a lowercase English letter in each square. As a magician, Rikka can cast spells on the squares and give them magical power.

Firstly, she can choose a continuous sub-interval of squares and use a certain incantation to give these squares "the Power of Light". The incantation is just the concatenation of the letters on the chosen sub-interval of squares. For example, if Rikka chooses an interval of squares with letters 'a', 'b', and 'c' written on them from left to right, then the incantation is "abc".

Secondly, she can choose a continuous sub-interval of squares (can be the same or different) and use a certain incantation to give these squares "the Power of Darkness". The incantation is also the concatenation of the letters on the chosen squares.

Lastly, the squares that have both powers simultaneously will be activated.

Rikka wants the two incantations to be exactly the same. She wants to know, for each number $k$ from 0ドル$ to $n,ドル how many ways are there to use the same incantation twice and activate exactly $k$ squares. Can you help her?

입력

The first line of input contains the string $s$ consisting of lowercase English letters. The $i$-th letter of the string is the letter written in the $i$-th square from left to right. The length of the string is from 1ドル$ to 5ドル \cdot 10^5$ characters.

출력

Print a single line with $n + 1$ integers, where the $i$-th integer is the number of ways to activate exactly $i - 1$ squares. Here, $n$ is the length of the input string.

제한

예제 입력 1

aaaaa

예제 출력 1

13 9 6 4 2 1

힌트

출처

Camp > Petrozavodsk Programming Camp > Summer 2021 > Day 4: 2021 Shanghai ICPC Camp Onsite 1 by PKU H번

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

출처

대학교 대회

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

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