spoj#HARSTR. TWO STRINGS
TWO STRINGS
You are given two strings a and b. You have to remove the minimum possible number of consecutive (standing one after another) characters from string b in such a way that it becomes a submultiset of string a. It can happen that you will not need to remove any characters at all, or maybe you will have to remove all of the characters from b and make it empty.
Input
The first line contains string a, and the second line — string b. Both of these strings are nonempty and consist of lowercase letters of English alphabet. The length of each string is no bigger than 105 characters.
Output
On the first line output a submultiset of string a in sorted order , obtained from b. If multiple answer exists , output lexicographically smallest.
If the answer consists of zero characters, output «-» (a minus sign).
Example
Input:abacabaOutput:
abcdcbaaabbc
Input:abcdyOutput:
abdxybcabcdNote: Ouput is abcd not abcy since it's lexicographically smaller.
<pre><strong>Input:</strong><pre style="margin: 0px; padding: 0.25em; font-size: 12.6px; font-family: Consolas, "Lucida Console", "Andale Mono", "Bitstream Vera Sans Mono", "Courier New", Courier; line-height: 1.25em; white-space: pre-wrap; word-wrap: break-word; color: #880000; background-color: #efefef;">abacaba<br>abcdcba</pre><strong>Output:</strong><pre style="margin: 0px; padding: 0.25em; font-size: 12.6px; font-family: Consolas, "Lucida Console", "Andale Mono", "Bitstream Vera Sans Mono", "Courier New", Courier; line-height: 1.25em; white-space: pre-wrap; word-wrap: break-word; color: #880000; background-color: #efefef;">aabbc</pre></pr