CF346B.Lucky Common Subsequence

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

In mathematics, a subsequence is a sequence that can be derived from another sequence by deleting some elements without changing the order of the remaining elements. For example, the sequence BDF is a subsequence of ABCDEF. A substring of a string is a continuous subsequence of the string. For example, BCD is a substring of ABCDEF.

You are given two strings s1s_{1} , s2s_{2} and another string called virusvirus . Your task is to find the longest common subsequence of s1s_{1} and s2s_{2} , such that it doesn't contain virusvirus as a substring.

输入格式

The input contains three strings in three separate lines: s1s_{1} , s2s_{2} and virusvirus ( 1<=s1,s2,virus<=1001<=|s_{1}|,|s_{2}|,|virus|<=100 ). Each string consists only of uppercase English letters.

输出格式

Output the longest common subsequence of s1s_{1} and s2s_{2} without virusvirus as a substring. If there are multiple answers, any of them will be accepted.

If there is no valid common subsequence, output 0.

输入输出样例

  • 输入#1

    AJKEQSLOBSROFGZ
    OVGURWZLWVLUXTH
    OZ
    

    输出#1

    ORZ
    
  • 输入#2

    AA
    A
    A
    

    输出#2

    0
    
首页