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. angularJs-UI-bootstrap系列教程1(使用前的准备)

    之前一直想看看angular中Ui-bootstrap是如何使用的,但是苦于网站被墙了,一直看不到,最近偷偷的到墙外面看了一下文档,大致的了解了如何使用,在这里写这边文章主要就是为了那些被墙了的ang ...

  2. POJ 3186 Treats for the Cows

    简单DP dp[i][j]表示的是i到j这段区间获得的a[i]*(j-i)+... ...+a[j-1]*(n-1)+a[j]*n最大值 那么[i,j]这个区间的最大值肯定是由[i+1,j]与[i,j ...

  3. [Big Data]hadoop分布式系统在Linux系统安装

    待完善 Hadoop2.6.0部署与应用 一.    环境准备 硬件:3台虚拟机 内存:至少512MB 硬盘:至少20G 操作系统:rhel6.4  64位 最小化安装 主机名 IP(局域网) 描述 ...

  4. Android开发:组播(多播)与广播

    近期由于需要编写能够使同一局域网中的Android客户端与PC端进行自动匹配通信功能的程序,学习并试验了JAVA组播与广播的内容,记录一些理解如下: 一.组播(多播) 背景知识:组播使用UDP对一定范 ...

  5. ARM架构解析

    ARM架构解析 (2014-11-23 21:56:53) 转载▼ 标签: francis_hao arm架构 arm核 soc 分类: MCU 先来谈一下ARM的发展史:1978年12月5日,物理学 ...

  6. spring mvc3中JACKSON序列化日期格式的问题 - 墙头草的Java - BlogJava

    body { font-family: "Microsoft YaHei UI","Microsoft YaHei",SimSun,"Segoe UI ...

  7. window.location获取URL中各部分

    博客分类: JAVASCRIPT JavaScriptASP.netSchemeASP网络协议  URL即:统一资源定位符 (Uniform Resource Locator, URL) 完整的URL ...

  8. JSON的BUG

    问题描述: method_cfg["input_method"][0].asString() 报错误: test1.cpp:40:46: error: ambiguous over ...

  9. laravel5 数据库连接问题

    [PDOException] SQLSTATE[28000] [1045] Access denied for user ‘homestead’@’localhost’ (using password ...

  10. Android源码编译jar包BUILD_JAVA_LIBRARY 与BUILD_STATIC_JAVA_LIBRARY的区别(一)

    一般情况下,在Android源码下编译一个jar包的典型makefile(Android.mk)如下: 在文件中加入以下内容: LOCAL_PATH:= $(call my-dir)#make jar ...