codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

757A.md (2098B)


      1 Source: https://codeforces.com/problemset/problem/757/A
      2 
      3 A. Gotta Catch Em' All!
      4 
      5 time limit per test
      6 
      7 1 second
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 standard input
     16 
     17 output
     18 
     19 standard output
     20 
     21 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.
     22 
     23 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.
     24 
     25 Given the text on the front page of the newspaper, can you tell how many Bulbasaurs he will catch today?
     26 
     27 Note: uppercase and lowercase letters are considered different.
     28 
     29 Input
     30 
     31 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*.
     32 
     33 The string *s* contains lowercase and uppercase English letters, i.e. ![](https://espresso.codeforces.com/927e573ae77bcc049bc41fe8c3a0e981a45e9cd2.png).
     34 
     35 Output
     36 
     37 Output a single integer, the answer to the problem.
     38 
     39 Examples
     40 
     41 Input
     42 
     43 ```
     44 Bulbbasaur
     45 ```
     46 
     47 Output
     48 
     49 ```
     50 1
     51 ```
     52 
     53 Input
     54 
     55 ```
     56 F
     57 ```
     58 
     59 Output
     60 
     61 ```
     62 0
     63 ```
     64 
     65 Input
     66 
     67 ```
     68 aBddulbasaurrgndgbualdBdsagaurrgndbb
     69 ```
     70 
     71 Output
     72 
     73 ```
     74 2
     75 ```
     76 
     77 Note
     78 
     79 In the first case, you could pick: Bulbbasaur.
     80 
     81 In the second case, there is no way to pick even a single Bulbasaur.
     82 
     83 In the third case, you can rearrange the string to BulbasaurBulbasauraddrgndgddgargndbb to get two words "Bulbasaur".