A. Gotta Catch Em' All!

time limit per test
1 second
memory limit per test

256 megabytes

input

standard input

output

standard output

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

 //2017.01.18
#include <iostream>
#include <cstdio>
#include <cstring> using namespace std; const int inf = 0x3f3f3f3f;
int book[]; int main()
{
string str;
string bul = "Bulbbasaur";
while(cin >> str)
{
memset(book, , sizeof(book));
for(int i = ; i < str.length(); i++)
book[str[i]]++;
book['u']/=;
book['a']/=;
int ans = inf;
for(int i = ; i < bul.length(); i++)
if(ans > book[bul[i]])
ans = book[bul[i]];
cout<<ans<<endl;
} return ;
}

CodeForces757A的更多相关文章

随机推荐

  1. PAT 天梯赛 L2-004 这是二叉搜索树吗?

    递归判断+建树 题目链接:https://www.patest.cn/contests/gplt/L2-004 题解 二叉搜索树的特点就是其根节点的值是位于左右子树之间的,即大于左子树的所有值,但是小 ...

  2. postgresql 数据库的备份和恢复 (pg_dump 和 pg_restore)

    pg_dump 用来备份数据库: pg_restore 用来恢复数据库: 备份出来的文件可以用 XZ (linux 自带的压缩工具压缩). XZ压缩最新压缩率之王 xz这个压缩可能很多都很陌生,不过您 ...

  3. HDU 5613 Baby Ming and Binary image

    因为第一行和最后一行都是0,我们只需枚举最左边或最右边一列的01情况,即可得到整张表 然后再检验表是否符合要求 #include<cstdio> #include<cstring&g ...

  4. <iOS>UIImage变为NSData并进行压缩

    http://www.cnblogs.com/robinkey/archive/2013/01/21/2869930.html //sdk中提供了方法可以直接调用 UIImage *img = [UI ...

  5. $smary模板缓存

    <?php //引入配置文件 $fillname="../cache/testhuancun.html"; //设置一个缓存时间 $time=; //判断如果缓存文件不存在的 ...

  6. 微信小程序之----navigator页面跳转

    navigator navigator跳转页面样式分为两种一种是左上角带返回按钮跳转到新的页面,另一种不带即在本页跳转,通过控制redirect属性 .js <view> <navi ...

  7. IOS开发-OC学习-protocol(协议)

    在OC语言中,协议是一组方法,里面有两种方法,一种是遵守这个协议的类的实例必须实现的方法,另一种是可以实现也可以不实现的方法. 例如我定义一个学生的协议,这个协议里有两个方法,其中一个是必选的方法:学 ...

  8. leetcode day6

    [13]Roman to Integer Given a roman numeral, convert it to an integer. Input is guaranteed to be with ...

  9. Swing 布局时 组件大小问题

    在JFrame中放置了几个JPanel ,想调整JPanel大小,一直无效. 问题在于: 因为JPanel A的四周没有添加任何组件,所以JPanel B会把JPanel A填满.这种情况想固定JPa ...

  10. jquery textarea输入字符字数提示

    效果: html代码: <textarea id="assayInfo" name="assayInfo" rows="3" cols ...