You are given a string s consisting only of uppercase English letters 'A' to 'Z'. A positive integer len is called valid if:
lenis the length of some prefix ofs;- The entire string
scan be split into one or more non-overlapping substrings of lengthlen. - Every substring has exactly the same character frequency distribution as the prefix
s[0..len - 1].
The substrings do not need to be identical. They only need to contain the same number of each character. Equivalently, a prefix length len is valid if s can be partitioned into blocks of length len, and every block has the same character frequency distribution as the prefix s[0..len - 1].
Ask AI Assistant

Ask AI Assistant
Ask me anything about this coding question!
Test Cases
Input
Output
Expected