Company: Walmart_12march
Difficulty: medium
Ideal Fruit Arrangement Problem Description You are given a string s in which different characters represent different type of fruits. A fruit arrangement y is considered "ideal" if it meets two criteria: The count of each fruit type in y should not exceed its count in s . The arrangement y should be the smallest lexicographically among all possible arrangements derived from the fruits in y . Find how many distinct ideal fruit arrangements can be created. Return the result modulo 10^9 + 7. Note: s will contain only lowercase alphabets. Input Format The input consists of a single line containing the string s where each character represents a type of fruit. Output Format Print a single integer representing the number of distinct ideal fruit arrangements. Examples Example 1: Input: s = "aba" Output: 5 Explanation: For the string s = "aba" , the possible ideal arrangements are: (a, b, aa, ab, aab) Example 2: Input: s = "ab" Output: 3 Explanation: For the string s = "ab" , the possible idea