Company: UKG
Difficulty: medium
Anagram Period A string can be formed using another string \(s\) by repeatedly concatenating the anagrams of \(s\) any number of times. Given a string, \(input\_str\) of length \(n\), find out the length of the smallest string \(s\) that can be used to create \(input\_str\). Note that the string \(input\_str\) only consists of the lowercase English letters. Input String Description input_str = "abababaabb" In the above example, the length of the string \(n = 8\). One of the possible strings \(s\) can be "aabb". First append "abab" and then append "baab". Another possible string \(s\) can be "ab", append the anagrams of \(s\) in the order: "ab", "ab", "ab" and "ab". It can be proved that the length of \(s\) cannot be reduced further than 2. Hence, we return 2 as the answer. Complete the function getAnagramPeriod in the editor below. getAnagramPeriod has the following parameter(s): string input_str : a string of length \(n\) Returns int : the length of the smallest possible string \(s\)