Least Common Divisor

아직 제출이 없습니다시간 제한2초메모리 제한512 MB

문제

A divisor of string AA is a string DD which can be repeated an integer number of times to obtain AA. 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 SS and TT. Find the shortest of strings which are simultaneously divisors of SS and divisors of TT, or determine that there are no such strings.

입력

The first line contains string SS, and the second line contains string TT. Each of these strings has length from 11 to 5050 characters, inclusive, and consists only of lowercase English letters.

출력

Print the least common divisor of strings SS and TT, or the string "No solution" in case the least common divisor does not exist.