t **generates** a string s if s is t written one or more times in a row: s = t + t + … + t.
Given strings first and second, return the longest string that generates both of them. If there is none, return the empty string.first='XYXYXYXY', second='XYXY' → 'XYXY'
Both strings are built from XYXY (twice and once), and no longer block works.
first='KKKKKK', second='KKKK' → 'KK'
KK repeats 3 and 2 times; KKKK fails because six letters cannot be built from it.
first='ABA', second='AB' → ''
There is no common block, so the answer is the empty string.
first='XYXYXYXY', second='XYXY'
'XYXY'
Run checks the first 3 tests in your browser. Submit checks all 175 tests on the server, hidden ones included.