Double-Colored Papers

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

문제

In your factory, you are making two kinds of colored paper, one colored red, and the other colored blue.

Each red-colored paper has a string SS written on it: it is made of S|S| unit squares in a row, and S_iS\_i is written on the iith square from the left.

Each blue-colored paper has a string TT written on it: it is made of T|T| unit squares in a row, and T_iT\_i is written on the iith square from the left.

You plan to make a new kind of paper called double-colored paper out of red and blue paper. To do so, you will cut down a piece of red paper to only leave the continuous part with a positive integer length, and again with blue paper. Then, you will glue the ending part of the red paper to the starting part of the blue paper.

For example, suppose SS is abcde and TT is fghij. You can make a double-colored paper with string bcdfg or abcij written on it. However, you cannot make a double-colored paper with string acdghij or fghij written on it. (Here the underlined string denotes a part of the red paper, and the rest denotes a part of the blue paper.)

Among all possible double-colored papers that can be made, you want to know the one with the lexicographically KK-th smallest string written on it. Note that there may be papers with the same strings written on them, but with different lengths of red paper: in this case, you may order them arbitrarily.

입력

The first line contains string SS.

The second line contains string TT.

The third line contains integer KK.

출력

If the total number of possible double-colored papers is strictly less than KK, output 1-1.

Otherwise, output the lexicographically KK-th smallest string of all possible double-colored papers that can be made.

제한

  • 1S75,0001\le |S|\le 75\\, 000
  • 1T75,0001\le |T|\le 75\\, 000
  • SS and TT consists of lowercase alphabets.
  • 1K8×10181\le K\le 8\times 10^{18}