No.291 Black String
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もしくは右上の雲マークをクリックしてアカウントを作成してください。