Longest repeated frame block
Your task
A link tester records the frames a radio receives as one string, one letter per frame type. When the link stutters the receiver takes a block of frames and then immediately takes the very same block again, sometimes several times over, with nothing in between. Given the capture, return the length of the longest stretch that is one block written two or more times back to back. Such a stretch is always a whole number of copies, so its length is a multiple of its block length. Return 0 when no stretch qualifies. Copies have to be adjacent: in abcxabc the two copies of abc are separated, so nothing qualifies, while abcabcab answers 6. A run of one letter counts too, since a single letter is a block, so aaaaa answers 5.
Examples
longest_tandem_burst(capture: str) -> intExample 1
Input
longest_tandem_burst("abcabcab")Output
6Example 2
Input
longest_tandem_burst("abcxabc")Output
0Example 3
Input
longest_tandem_burst("aaaaa")Output
5