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

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education