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|  ≤  10^5) — 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_{i} \in \{a, b, \ldots, z, A, B, \ldots, Z \}$.


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

Difficulty: competition

Starter code:

Solutions:
from collections import Counter

def main():
    s = input()

    c = Counter(s)
    w = Counter("Bulbasaur")

    ans = 1e9
    for char in w:
        ans = min(ans, c[char] // w[char])

    print(ans)


main()


#!/usr/bin/env python3

def main():
    from collections import Counter

    try:
        while True:
            c = Counter(input())
            print(min(c['B'], c['u'] >> 1, c['l'], c['b'], c['a'] >> 1, c['s'], c['r']))

    except EOFError:
        pass

main()


s = input()
ans = s.count("B")
ans = min(ans, s.count("u") // 2)
ans = min(ans, s.count("l"))
ans = min(ans, s.count("b"))
ans = min(ans, s.count("a") // 2)
ans = min(ans, s.count("s"))
#a
#u
ans = min(ans, s.count("r"))
print(ans)


string = input()
line = []
for i in range(7):
    line += [0]
for i in range(len(string)):
    if (string[i] == "B"):
        line[0] += 1
    if (string[i] == "u"):
        line[1] += 0.5  
    if (string[i] == "l"):
        line[2] += 1
    if (string[i] == "b"):
        line[3] += 1 
    if (string[i] == "a"):
        line[4] += 0.5  
    if (string[i] == "s"):
        line[5] += 1
    if (string[i] == "r"):
        line[6] += 1 
print(int(min(line)))


import collections


def main():
    s = input()
    cou = collections.Counter(s)
    bul = 'Bulbasaur'
    cou2 = collections.Counter(bul)
    res = 10**9
    for item in cou2:
        res = min(res, cou[item] // cou2[item])
    print(res)


def __starting_point():
    main()

__starting_point()

s=input()
a=[0]*255
for i in s:
    a[ord(i)]+=1
ans=10**5
for i in 'Blbsr':
    ans=min(ans,a[ord(i)])
for i in 'au':
    ans=min(ans,a[ord(i)]//2)
print(ans)


def solve(s):
    T = {}
    for c in 'Bulbasaur':
        if c in T:
            T[c] += 1
        else:
            T[c] = 1

    S = len(s)
    for c in T:
        S = min(S, s.count(c)//T[c])

    return S
    
s = input().rstrip()
print(solve(s))


q = "Balbsur"
d = dict([[x, 0] for x in q])
s = input().strip()
for x in s:
    if x in q:
        d[x] += 1
    
m = min(d["u"], d["a"]) // 2
for x in d:
    m = min(m, d[x])
print(m)

d={'B':0,'u':0,'l':0,'b':0,'a':0,'s':0,'a':0,'u':0,'r':0}
for x in input():
    if x in d: d[x]+=1
d['a']//=2; d['u']//=2
print(min(d.values()))

3

secret = "Bulbasaur"
d = dict()
for c in secret:
    if c not in d:
        d[c] = 0
    d[c] += 1

s = input()
e = dict()
for c in s:
    if c not in e:
        e[c] = 0
    e[c] += 1

answ = 1791791791
for c in list(d.keys()):
    if c not in e:
        answ = 0
    else:
        answ = min(answ, e[c] // d[c])

print(answ)


q = input()
p = [0] * 250
for i in q:
    p[ord(i)] += 1
ans = p[ord('B')]
ans = min(ans, p[ord('u')] // 2)
ans = min(ans, p[ord('a')] // 2)
ans = min(ans, p[ord('s')])
ans = min(ans, p[ord('b')], p[ord('l')], p[ord('r')])
print(ans)

s = input()
B = s.count("B")
u = s.count("u")//2
l = s.count("l")
b = s.count("b")
a = s.count("a")//2
s1 = s.count("s")
r = s.count("r")
print(min(B, u, l, b, a, s1, r))


s=input()
tmp='Bulbasaur'
d={i:0 for i in tmp}
for i in s:
    if i in d:
        d[i]+=1
ans=100000
for i in d:
    chk=d[i]
    if i=='a' or i=='u':
        chk//=2
    ans=min(ans,chk)
print(ans)

n = input()
cnt = [0] * 7
for i in range(len(n)):
    if n[i] == 'B':
        cnt[0] += 1
    elif n[i] == 'u':
        cnt[1] += 1
    elif n[i] == 'l':
        cnt[2] += 1
    elif n[i] == 'b':
        cnt[3] += 1
    elif n[i] == 'a':
        cnt[4] += 1
    elif n[i] == 's':
        cnt[5] += 1
    elif n[i] == 'r':
        cnt[6] += 1
cnt[4] //= 2
cnt[1] //= 2
print(min(cnt))

from collections import Counter

c = Counter(input())
print(min(c['B'], c['u'] // 2, c['l'], c['b'], c['a'] // 2, c['s'], c['r']))

from collections import deque
from collections import Counter

def main():
    from sys import stdin
    lines = deque(line.strip() for line in stdin.readlines())
    # lines will now contain all of the input's lines in a list
    counts = Counter(lines[0])
    bulbasaur = Counter("Bulbasaur")
    minCount = len(lines[0])
    for letter, count in list(bulbasaur.items()):
        minCount = min(minCount, counts[letter] // count)
    print(minCount)


def __starting_point():
    main()

__starting_point()

s = input()
c1 = s.count('B')
c2 = s.count('u')
c3 = s.count('l')
c4 = s.count('b')
c5 = s.count('a')
c6 = s.count('s')
c7 = s.count('r')
print(min(c1, c2//2, c3, c4, c5//2, c6, c7))

d={}
for i in input().strip():
  d[i] = d.get(i,0)+1
ans = min(d.get('B',0),d.get('u',0)//2,d.get('l',0),d.get('b',0),d.get('a',0)//2,d.get('s',0),d.get('r',0))
print(ans)


s = input()

d = {}

for c in s:
    d[c] = d.get(c, 0) + 1

B = d.get('B', 0)
u = d.get('u', 0) // 2
l = d.get('l', 0)
b = d.get('b', 0)
a = d.get('a', 0) // 2
s = d.get('s', 0)
r = d.get('r', 0)

print(min(B, u, l, b, a, s, r))

#!/usr/bin/env python3
text = input()
bolba="Bulbasaur"
chars = {}
for i in bolba:
	chars[i] = 0
for i in text:
	if i in bolba:
		chars[i]+=1
chars['u'] = chars['u']//2
chars['a'] = chars['a']//2
print(min(chars.values()))


from collections import Counter

s = Counter(input())
w = Counter("Bulbasaur")

ans = 10 ** 5

for x, y in w.most_common():
    ans = min(ans, s[x] // y)

print(ans)


f = input()
B=f.count('B')
u=f.count('u') // 2
l=f.count('l')
b=f.count('b') 
a=f.count('a') // 2
s=f.count('s')
r=f.count('r')
print(min(B,u,l,b,a,s,r))

s = "Bulbasaur"
lst = input().strip()
cnt1 = [0] * 26
cnt2 = [0] * 26
for i in range(len(lst)):
    if lst[i] >= 'a' and lst[i] <= 'z':
        cnt1[ord(lst[i]) - ord('a')] += 1
    else:
        cnt2[ord(lst[i]) - ord('A')] += 1
answer = 1e6
for i in range(1, len(s)):
    answer = min(answer, cnt1[ord(s[i]) - ord('a')])
answer = min(answer, cnt1[0] // 2, cnt1[ord('u') - 97] // 2)
print(min(answer, cnt2[1]))

from collections import Counter
counter = Counter(input())
Bulbasaur = Counter('Bulbasaur')
ans = 0
while (counter & Bulbasaur) == Bulbasaur:
    counter.subtract(Bulbasaur)
    ans += 1
print(ans)