Suppose we have a lowercase string s, we have to find how many "pizza" strings we can make using the characters present in s. We can use the characters in s in any order, but each character can be used once.
So, if the input is like "ihzapezlzzilaop", then the output will be 2.
To solve this, we will follow these steps −
Let us see the following implementation to get better understanding −
class Solution: def solve(self, s): p_freq = s.count('p') i_freq = s.count('i') z_freq = s.count('z') a_freq = s.count('a') return min(p_freq, i_freq, z_freq // 2, a_freq) ob = Solution() print(ob.solve("ihzapezlzzilaop"))