Skip to content
C

Longest Common Subsequence

Mediumjavapythonccppjavascript

Given two strings, find the length of their longest subsequence that appears in both strings in the same relative order (characters need not be contiguous).

Input Format

The first line contains string A. The second line contains string B. Both consist of lowercase English letters with no spaces.

Output Format

Print the length of the longest common subsequence.

Input (stdin)

Output

Run your code to see output here...