UVa 10405

From Algorithmist

Jump to: navigation, search

Contents

[edit] 10405 - Longest Common Subsequence

[edit] Summary

Given two strings, find the Longest Common Subsequence.

[edit] Explanation

Textbook Dynamic Programming problem. No tricks to it.

[edit] Gotchas

The input includes some blank lines.

[edit] Input

a1b2c3d4e
zz1yy2xx3ww4vv
abcdgh
aedfhr
abcdefghijklmnopqrstuvwxyz
a0b0c0d0e0f0g0h0i0j0k0l0m0n0o0p0q0r0s0t0u0v0w0x0y0z0
abcdefghijklmnzyxwvutsrqpo
opqrstuvwxyzabcdefghijklmn

[edit] Output

4
3
26
14
Personal tools