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

      All Properties Methods Inherited Non-inherited Description AreaOfInterest The default area of inte ...

  2. Counting Haybales

    Counting Haybales 题目描述 Farmer John is trying to hire contractors to help rearrange his farm, but so ...

  3. Android学习笔记之Broadcast Receiver

    可程序间通信 注册通信,注销通信,发送消息 package com.jiahemeikang.helloandroid; import com.jiahemikang.service.EchoServ ...

  4. Hibernate---O/R Mapping

    1. JDBC数据库繁琐 2. sql语句不是面向对象 3. 可以在对象和关系表之间建立关联简化编程 4. O/R Mapping可以简化编程, 跨越数据库平台 比较流行的O/R Mapping Fr ...

  5. Jetty实战之 嵌入式Jetty运行Servlet

    http://blog.csdn.net/kongxx/article/details/7230080 Jetty实战之 嵌入式Jetty运行Servlet 分类:JettyJava (19530)  ...

  6. sublime text 我的常用配置

    { "color_scheme": "Packages/Color Scheme - Default/IDLE.tmTheme", "font_fac ...

  7. iOS进阶

    著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注明出处.作者:wjh2005链接:https://www.zhihu.com/question/28518265/answer/887505 ...

  8. INSTALL_FAILED_UPDATE_INCOMPATIBLE

    安装apk的时候,报错. 解决:把所有这个apk的相关信息删除干净,隐藏较深的是设置->应用管理->这个应用的相关信息删除干净就可以了

  9. Valgrind 快速入门

    1. 介绍 Valgrind工具组提供了一套调试与分析错误的工具包,能够帮助你的程序工作的更加准确,更加快速.这些工具之中最有名的是Memcheck.它能够识别很多C或者C++程序中内存相关的错误,这 ...

  10. func 和action 委托的使用

    func 可以带返回值,action  不带返回值 平时我们如果要用到委托一般都是先声明一个委托类型,比如: private delegate string Say(); string说明适用于这个委 ...