| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 2 초 (추가 시간 없음) | 512 MB | 129 | 80 | 57 | 59.375% |
A divisor of string $A$ is a string $D$ which can be repeated an integer number of times to obtain $A$. For example, divisors of string "aaaa" are strings "a", "aa", and "aaaa", and divisors of string "ababab" are strings "ab" and "ababab".
Consider two strings $S$ and $T$. Find the shortest of strings which are simultaneously divisors of $S$ and divisors of $T,ドル or determine that there are no such strings.
The first line contains string $S,ドル and the second line contains string $T$. Each of these strings has length from 1ドル$ to 50ドル$ characters, inclusive, and consists only of lowercase English letters.
Print the least common divisor of strings $S$ and $T,ドル or the string "No solution" in case the least common divisor does not exist.
abab ababab
ab
aaaa aaaa
a
abc de
No solution