No.346 Chihuahua Counting Problem
レベル :
/ AI推定難易度 : 500
/ 実行時間制限 : 1ケース 2.000秒 / メモリ制限
: 512 MB / 標準ジャッジ問題
タグ : / 解いたユーザー数 421
作問者 :
🍡yurahuna
タグ : / 解いたユーザー数 421
作問者 :
🍡yurahuna
問題文最終更新日: 2026-06-25 21:26:28
English (AI translation)
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence.
Back to the original
yukicoder contest 132
(順位表)
の他の問題:
Problem Statement
Lately, C has been running low on Chihuahua essence, so C has decided to find lots of Chihuahuas in strings.
C recognizes the string "cww" as a Chihuahua.
(Note that this definition differs from that of "Chihuahua sequence" in "Minimum Chihuahua Problem")
Given a string $S$, find the total number of its subsequences (which need not be contiguous) that are Chihuahuas.
Input
S
The first line contains the string $S (1 \le |S| \le 100000)$.
$S$ consists of lowercase letters only.
Output
Output as an integer the total number of subsequences (which need not be contiguous) of $S$ that are Chihuahuas.
Print a newline at the end.
Sample
Sample 1
Input
chiwachiwachiwawaparadise
Output
10
Sample 2
Input
yeswecan
Output
0
Sample 3
Input
cwcwcwwwcccccccccccwwwww
Output
219
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。