403670: GYM101237 G Total LCS

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

Description

G. Total LCStime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Let us define a function to be the length of the longest common subsequence of two strings S and T. More formally, is the length of the longest (possibly empty) string which is a subsequence of S and a subsequence of T. A string A is a subsequence of a string B if A can be obtained from B by erasing some (possibly none) characters (without permuting them!).

You are given two strings S and T. For a pair (i, j) where 1 ≤ i ≤ j ≤ |T|, let us define to be a substring of T consisting of symbols on positions from i to j inclusive.

Calculate all values of .

Input

The two lines of input contain the strings S and T (1 ≤ |S|, |T| ≤ 2000). The strings consist of lowercase English letters.

Output

Output the values of over all possible pairs (i, j) according to the lexicographical order of pairs (i, j).

The checking program ignores all whitespace (including line breaks), so it is up to you to format the output like a table (as we did in the example) or otherwise.

ExamplesInput
abac
cbabc
Output
1 1 2 2 3
  1 2 2 3
    1 2 3
      1 2
        1

加入题单

算法标签: