addressing expositions of two understudies who are suspected miscreants. For any two strings C, D we characterize their likeness score S(C,D) as 4⋅LCS(C,D)−|C|−|D|, where LCS(C,D) signifies the length of the Longest Common Subsequence of strings C and D.    You accept that main some piece of the expositions might

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter15: Recursion
Section: Chapter Questions
Problem 6PE
icon
Related questions
Question

Correct answer will be upvoted else Multiple Downvoted. Don't submit random answer. Computer science.

You are given two strings An and B addressing expositions of two understudies who are suspected miscreants. For any two strings C, D we characterize their likeness score S(C,D) as 4⋅LCS(C,D)−|C|−|D|, where LCS(C,D) signifies the length of the Longest Common Subsequence of strings C and D. 

 

You accept that main some piece of the expositions might have been replicated, along these lines you're keen on their substrings. 

 

Work out the maximal likeness score over all sets of substrings. All the more officially, output maximal S(C,D) over all sets (C,D), where C is some substring of A, and D is some substring of B. 

 

In case X is a string, |X| means its length. 

 

A string a will be a substring of a string b if a can be acquired from b by erasure of a few (potentially, zero or all) characters from the start and a few (conceivably, zero or all) characters from the end. 

 

A string a will be an aftereffect of a string b if a can be gotten from b by cancellation of a few (conceivably, zero or all) characters. 

 

Focus on the distinction between the substring and aftereffect, as the two of them show up in the issue articulation. 

 

You might wish to peruse the Wikipedia page about the Longest Common Subsequence issue. 

 

Input 

 

The main line contains two positive integers n and m (1≤n,m≤5000) — lengths of the two strings An and B. 

 

The subsequent line contains a string comprising of n lowercase Latin letters — string A. 

 

The third line contains a string comprising of m lowercase Latin letters — string B. 

 

Output 

 

Output maximal S(C,D) over all sets (C,D), where C is some substring of A, and D is some substring of B.

 

 

Expert Solution
steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Knowledge Booster
Introduction to classical planning
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning