CF762C.Two strings

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

You are given two strings aa and bb . You have to remove the minimum possible number of consecutive (standing one after another) characters from string bb in such a way that it becomes a subsequence of string aa . 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 bb and make it empty.

Subsequence of string ss is any such string that can be obtained by erasing zero or more characters (not necessarily consecutive) from string ss .

输入格式

The first line contains string aa , and the second line — string bb . Both of these strings are nonempty and consist of lowercase letters of English alphabet. The length of each string is no bigger than 10510^{5} characters.

输出格式

On the first line output a subsequence of string aa , obtained from bb 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 aa and bb don't share any symbols, so the longest string that you can get is empty.

In the second example ac is a subsequence of aa , and at the same time you can obtain it by erasing consecutive symbols cepted from string bb .

首页