Problem J
Nafnagift
Languages
en
is
A string $t$ is a subsequence of a string $s$ if it is possible to attain $t$ by removing some (or none) of the letters in $s$. For example, the string snati is a subsequence of ísknattleikur.
Input
The input consists of two lines. Each line contains a string corresponding to the candidate names your children provided. The length of each string is at least $1$ and at most $n$ and contains only lower case letters of the English alphabet.
Output
The output should contain a name for the cat that both children are satisfied by. Of all possible names, print the shortest. If there are more than one name of equal shortest length, print any of them.
Scoring
Group |
Points |
Constraints |
1 |
33 |
$n \leq 10$, the strings only contain the letters a and b |
2 |
27 |
$n \leq 10$ |
3 |
40 |
$n \leq 10^3$ |
Sample Input 1 | Sample Output 1 |
---|---|
bjarki bergur |
bjaergurki |
Sample Input 2 | Sample Output 2 |
---|---|
kisi kisi |
kisi |
Sample Input 3 | Sample Output 3 |
---|---|
aaaaa bb |
aaaaabb |