TopCoder

User's AC Ratio

NaN% (0/0)

Submission's AC Ratio

NaN% (0/0)

Tags

Description

Given two strings, output it's length of longest common subsequence (LCS).

Input Format

The first line contains one number n, denoting number of test cases, each test case contains two string without spaces, each on a line. The length of string are no more than 100.

Output Format

For each test case, output the length of LCS on a line.

Sample Input 1

2
abc
cba
abcdefghijklmnopqrstuvwxyz
beeiscolorful

Sample Output 1

1
7

Problem Source

Migrated from old NTUJ.

Subtasks

No. Testdata Range Score

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 1000 65536 20