Common Substring#2354

Common Substring

2 seconds
64 megabytes
Medium

Two strings consisting of and are given. Consider all substrings that are common to both given strings. Find the -th such substring in lexicographical order.

A string is lexicographically smaller than a string if one of the following holds:

Input

The first two lines contain the given strings, each of length at most . The third line contains a positive integer that does not exceed the number of common substrings of the two given strings.

Output

Output the -th common substring of the given strings in lexicographical order.

Examples

Example 1

Loading
Loading