問題一覧 > 通常問題

No.291 Black String

レベル : / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 69
作問者 : kzyKT
お気に入りにしたユーザー ProblemId : 622 / 自分の提出
問題文最終更新日: 2026-06-26 05:30:23
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 123 (順位表) の他の問題:

Problem Statement

Since I like black things, I decided to make many subsequences$(Subsequence)$ "$KUROI$" from a string.
A character once used in a subsequence must not be used as a character of another subsequence.

When I eagerly tried to count how many I could make, I found that some of the characters had disappeared.
In the places where characters had disappeared, I wrote characters so that the number of subsequences "$KUROI$" would be as large as possible.

Find the maximum number of subsequences "$KUROI$" that can be made.

* This may not pass in slow languages.

Input

$S$

A string is given on $1$ line.

$1 \le |S| \le 100$
$S$ : a string consisting of uppercase letters '$A$' to '$Z$' or '$?$'
'$?$' indicates that the character at that position has disappeared.

Output

Output the maximum number of subsequences "$KUROI$" that can be made from the string.

Sample

Sample 1
Input
KKUROI
Output
1

Sample 2
Input
KOIRU
Output
0

Sample 3
Input
KUROIME?UR?CHA?
Output
2

Sample 4
Input
KKUURROOII
Output
2

Added

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。