Common Substring (Easy)#5288

Common Substring (Easy)

1 second
64 megabytes
Easy

Given two strings consisting of the characters and , consider all strings that are substrings of both given strings. Find the -th such common substring in lexicographical order.

A string is considered lexicographically smaller than a string if one of the following conditions is satisfied:

Input

The input consists of three lines. The first and second lines contain the two given strings, each of length at most . The third line contains a positive integer , which does not exceed the number of common substrings of the two given strings.

Output

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

Examples

Example 1

Loading
Loading