【CF#757A】Gotta Catch Em' All!

题干:

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.

Input

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. .

Output

Output a single integer, the answer to the problem.

Examples
Input
Bulbbasaur
Output
1
Input
F
Output
0
Input
aBddulbasaurrgndgbualdBdsagaurrgndbb
Output
2
Note

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".


解题报告:

    水题不解释。

ac代码:

#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
using namespace std;
const int MAX = 1e5+5;
char str[MAX];
int B,u,l,b,a,s,r;
int Min(int a,int b,int c,int d,int e,int f,int g) {
	int cmp[7]={a,b,c,d,e,f,g};
	return *min_element(cmp,cmp+7);
}
int main()
{
	scanf("%s",str);
	int len=strlen(str);
	for(int i = 0; i<len; i++) {
		switch (str[i])
		{
			case 'B' : B++;break;
			case 'u' : u++;break;
			case 'l' : l++;break;
			case 'b' : b++;break;
			case 'a' : a++;break;
			case 's' : s++;break;
			case 'r' : r++;break;
		}
	}
	a/=2;u/=2;
	printf("%d\n",Min(B,u,l,b,a,s,r));
	return 0 ;
 } 
 //Bulbasaur


全部评论

相关推荐

03-02 08:18
集美大学 Java
钱嘛数字而已:没有赛事奖项么?另外,项目经历字有点多哈,建议突出一下重点:用的什么技术,解决什么问题,达到什么效果。
大家都开始春招面试了吗
点赞 评论 收藏
分享
03-04 07:14
门头沟学院 C++
黑皮白袜臭脚体育生:老板:都给工作机会了还想要工资,哪来这么多好事
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务