7278: AtCoder Educational DP Contest —— F - LCS
[Creator : ]
Description
You are given strings $s$ and $t$. Find one longest string that is a subsequence of both $s$ and $t$.
Notes
A subsequence of a string x is the string obtained by removing zero or more characters from x and concatenating the remaining characters without changing the order.Input
Input is given from Standard Input in the following format:
$s\ t$
$s\ t$
Output
Print one longest string that is a subsequence of both $s$ and $t$.
If there are multiple such strings, any of them will be accepted.
If there are multiple such strings, any of them will be accepted.
Constraints
s and t are strings consisting of lowercase English letters.
$1≤∣s∣,∣t∣≤3000$
$1≤∣s∣,∣t∣≤3000$
Sample 1 Input
axyb
abyxb
Sample 1 Output
axb
The answer is axb or ayb; either will be accepted.
Sample 2 Input
aa
xayaz
Sample 2 Output
aa
Sample 3 Input
a
z
The answer is (an empty string).
abracadabra
avadakedavra
aaadara