### PROBLEM LINK:

**Author:** Varun Singh

### DIFFICULTY:

SIMPLE-EASY

### PREREQUISITES:

None

### PROBLEM:

Given a string of lowercase alphabets, find the number of times one can make the string ‘banana’ by using each character only once.

### QUICK EXPLANATION:

Count the frequency of characters ‘a’, ‘b’ and ‘n’. The result will be minimum of freq(b), freq(a)/3 and freq(n)/2, since we need 1 ‘b’, 2 ‘n’ and 3 ‘a’ to make the string ‘banana’.

### EXPLANATION:

Scan the string and store the frequency of characters ‘b’, ‘a’ and ‘n’. Since we need 1 ‘b’, 2 ‘n’ and 3 ‘a’ to make one instance of “banana”, divide the frequency of n by 2 and a by 3. The minimum frequency will be the desired result.

### AUTHOR’S SOLUTIONS:

Author’s solution can be found here.