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

27420번 - Incredibly Cute Penguin Chicks 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
6 초 1024 MB122615548.246%

문제

The Incredibly Cute Penguin Chicks love to eat worms. One day, their mother found a long string-shaped worm with a number of letters on it. She decided to cut this worm into pieces and feed the chicks.

The chicks somehow love International Collegiate Programming Contest and want to eat pieces with ICPC-ish character strings on them. Here, a string is ICPC-ish if the following conditions hold.

  • It consists of only C’s, I’s, and P’s.
  • Two of these three characters appear the same number of times (possibly zero times) in the string and the remaining character appears strictly more times.

For example, ICPC and PPPPPP are ICPC-ish, but PIC, PIPCCC and PIPE are not.

You are given the string on the worm the mother found. The mother wants to provide one or more parts of the worm all with an ICPC-ish string, without wasting remains. Your task is to count the number of ways the worm can be prepared in such a manner.

입력

The input is a single line containing a character string $S$ consisting of only C’s, I’s, and P’s, which is on the string-shaped worm the mother penguin found. The length of $S$ is between 1ドル$ and 10ドル^6,ドル inclusive.

출력

Print in a line the number of ways to represent the string S as a concatenation of one or more ICPC-ish strings modulo a prime number 998ドル,244円,353円 = 2^{23} \times 7 \times 17 + 1$.

제한

예제 입력 1

ICPC

예제 출력 1

2

예제 입력 2

CCCIIIPPP

예제 출력 2

69

예제 입력 3

PICCICCIPPI

예제 출력 3

24

힌트

In the first sample, the string “ICPC” can be represented in the following two ways.

  • A single ICPC-ish string, “ICPC”.
  • Concatenation of four ICPC-ish strings, “I”, “C”, “P”, and “C”.

출처

ICPC > Regionals > Asia Pacific > Japan > ICPC 2022 Asia Yokohama Regional E번

Camp > Petrozavodsk Programming Camp > Summer 2023 > Day 1: Starting Contest E번

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

출처

대학교 대회

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

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