CF757A.Gotta Catch Em' All!
入门
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Bash wants to become a Pokemon master one day. Although he liked a lot of Pokemon, he has always been fascinated by Bulbasaur the most. Soon, things started getting serious and his fascination turned into an obsession. Since he is too young to go out and catch Bulbasaur, he came up with his own way of catching a Bulbasaur.
Each day, he takes the front page of the newspaper. He cuts out the letters one at a time, from anywhere on the front page of the newspaper to form the word "Bulbasaur" (without quotes) and sticks it on his wall. Bash is very particular about case — the first letter of "Bulbasaur" must be upper case and the rest must be lower case. By doing this he thinks he has caught one Bulbasaur. He then repeats this step on the left over part of the newspaper. He keeps doing this until it is not possible to form the word "Bulbasaur" from the newspaper.
Given the text on the front page of the newspaper, can you tell how many Bulbasaurs he will catch today?
Note: uppercase and lowercase letters are considered different.
巴什总有一天想成为宝可梦大师。虽然他很喜欢很多宝可梦,但他一直对妙蛙种子(Bulbasaur)最为着迷。很快,事情变得认真起来,他的着迷逐渐演变成了痴迷。由于他还太小,无法外出捕捉妙蛙种子,于是他想出了自己独特的“捕捉”妙蛙种子的方法。
每天,他都会取来报纸的头版。他从头版的任意位置逐个剪下字母,拼出单词 "Bulbasaur"(不带引号),然后把它贴在墙上。巴什对大小写非常讲究——"Bulbasaur" 的首字母必须为大写,其余字母必须为小写。通过这种方式,他认为自己成功“捕捉”了一只妙蛙种子。接着,他继续在报纸剩余部分重复这一过程,不断剪下字母拼出 "Bulbasaur",直到报纸上再也无法拼出该单词为止。
已知报纸头版上的文字内容,请你计算出巴什今天一共能“捕捉”多少只妙蛙种子?
注意:大写字母与小写字母被视为不同的字符。
输入格式
Input contains a single line containing a string s (1 ≤ |s| ≤ 105) — the text on the front page of the newspaper without spaces and punctuation marks. |s| is the length of the string s.
The string s contains lowercase and uppercase English letters, i.e.
.
输入包含一行,其中有一个字符串 $ s ( 1 \leq |s| \leq 10^5 )——即报纸头版上的文字,不含空格和标点符号。 |s| $ 表示字符串 $ s $ 的长度。
字符串 $ s $ 仅由小写和大写英文字母组成,即
。
输出格式
Output a single integer, the answer to the problem.
输出一个整数,即该问题的答案。
输入输出样例
输入#1
Bulbbasaur
输出#1
1
输入#2
F
输出#2
0
输入#3
aBddulbasaurrgndgbualdBdsagaurrgndbb
输出#3
2
说明/提示
In the first case, you could pick: Bulbbasaur.
In the second case, there is no way to pick even a single Bulbasaur.
In the third case, you can rearrange the string to BulbasaurBulbasauraddrgndgddgargndbb to get two words "Bulbasaur".
在第一种情况下,你可以选出:“Bulbasaur”。
在第二种情况下,无法选出哪怕一个“Bulbasaur”。
在第三种情况下,你可以将字符串重排为 BulbasaurBulbasauraddrgndgddgargndbb,从而得到两个单词“Bulbasaur”。
输入解题思路,AI测评打分。不知道怎么写?