FZU 1502 Letter Deletion

Accept: 174    Submit: 398
Time Limit: 1000 mSec    Memory Limit : 32768 KB

Problem Description

You are given two words (each word consists of upper-case English letters).

Try to delete some letters from each word so that the resulting words are equal.

What is the maximum possible length of the resulting word?

Input

There will be no more than 10 test cases.

Each test case consists of a single line, contaning the two words separated by a single space. The length of each of these words is between 1 and 200.

Output

For each test case output the maximum length of a resulting word (the length of the longest word that can be created from both words by removing some letters).

If the two words have no letters in common, output 0.

Sample Input

AAABBB ABABAB
AXYAAZ CCCXCCCYCCCZCC
ABCDE EDCBA

Sample Output

4
3
1
//动态规划题;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值