String Product

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

문제

Let f(c)f(c) be the 00-based alphabetic number of a small English letter cc, hence f(a)=0f(`a`) = 0, f(b)=1f(`b`) = 1, \ldots, f(z)=25f(`z`) = 25. The product s×ts \times t of two strings s=s_0s_n1s = s\_0 \ldots s\_{n - 1} and t=t_0t_m1t = t\_0 \ldots t\_{m - 1} is a string u=u_0u_nm1u = u\_0 \ldots u\_{nm - 1}, where f(u_jn+i)=(f(s_i)+f(t_j))mod26f(u\_{j \cdot n + i}) = (f(s\_i) + f(t\_j)) \bmod 26 for all i=0,,n1i = 0, \ldots, n - 1 and j=0,,m1j = 0, \ldots, m - 1. For example, abc×de=defefg`abc` \times `de` = `defefg`, de×abc=deeffg`de` \times `abc` = `deeffg`, xy×yz=vwwx`xy` \times `yz` = `vwwx`.

You are given a string ss. Find two strings aa and bb such that a×b=sa \times b = s. If there are multiple options of aa and bb, find the one such that the string a+ba + b (where ++ stands for concatenation) is lexicographically smallest. If there are still several answers, find the one with the smallest length of aa.

입력

The only line of the input contains the string ss of small English letters (1s1061 \le |s| \le 10^6).

출력

If it is impossible to find two strings a,ba, b such that a×b=sa \times b = s, print 1-1. Otherwise, print aa and bb separated by a space. The string a+ba+b should be lexicographically smallest among all suitable pairs (a,b)(a, b). In case of a tie, a|a| should be smallest possible.