303961: CF762C. Two strings

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Two strings

题意翻译

给定 $2$ 仅包含小写字母字符串 $s$ 和 $t$,从 $s$ 中删除连续的一段字符,使得 $s$ 是 $t$ 的子序列。最小化删除的数量,并输出执行删除操作后的字符串 $s$。

题目描述

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 subsequence 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. Subsequence of string $ s $ is any such string that can be obtained by erasing zero or more characters (not necessarily consecutive) from string $ s $ .

输入输出格式

输入格式


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 $ 10^{5} $ characters.

输出格式


On the first line output a subsequence of string $ a $ , obtained from $ b $ by erasing the minimum number of consecutive characters. If the answer consists of zero characters, output «-» (a minus sign).

输入输出样例

输入样例 #1

hi
bob

输出样例 #1

-

输入样例 #2

abca
accepted

输出样例 #2

ac

输入样例 #3

abacaba
abcdcba

输出样例 #3

abcba

说明

In the first example strings $ a $ and $ b $ don't share any symbols, so the longest string that you can get is empty. In the second example ac is a subsequence of $ a $ , and at the same time you can obtain it by erasing consecutive symbols cepted from string $ b $ .

Input

题意翻译

给定两个仅包含小写字母字符串 $s$ 和 $t$,从 $t$ 中删除连续的一段字符,使得 $t$ 是 $s$ 的子序列。最小化删除的数量,并输出执行删除操作后的字符串 $t$。

加入题单

上一题 下一题 算法标签: