F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Longest Common Subsequence Again

Time Limit: 5000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 867    Accepted Submission(s): 73


Problem Description
Everyone knows LCS problem:

For example:
str1 = "GCTAT"
str2 = "CGATTA"

the longest common subsequence is "GTT" of them.So you should print "3".

I'm sure you can easily sovle it.So the challenge is coming again.(^_^)
 

Input
For each case,there are two lines.one is string A,the other is string B.
the string Process to end of file.Each string will have at most 30000 characters.
All the characters are in upper-case.
 

Output
For each case, output the maximum-length common subsequence.
 

Sample Input
GCTAT CGATTA ABCFBC ABFCAB
 

Sample Output
3 4
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 21:33:32, Gzip enabled