Take two alphabets from the user and compare them. Prefixes in which the alphabet specified first has a higher frequency than the second alphabet, such prefixes are printed, otherwise the result will be 0.
Input: string1 = "geek", alphabet1 = "e", alphabet2 = "k" Output: ge gee geek 3 Input: string1 = " geek ", alphabet1 =" k ", alphabet2 =" e " Output: 0
Approach: take an empty string to store the string values of all generated prefixes ... Then check the alphabet with a higher frequency than the second alphabet. If no such case is found, the result is 0 prefixes.
The implementation is as follows:
gee geek geeks geeksf geeksfo geeksfor geeksforge geeksforgee geeksforgeek pythonengineering 10