Question: Longest Common Subsequence problem please use PYTHON AND PROVIDE SCREENSHOTS AND Functional working code for good feedback A portion of the code has been provided

Longest Common Subsequence problem please use PYTHON AND PROVIDE SCREENSHOTS AND Functional working code for good feedback

A portion of the code has been provided for you just fill in the missing portion with commented lines of code explaining what you are doing

Please makesure it is able to hande the sample input and sample output I will be running cases on the code to see if it returns correct value sequence thanks

Longest Common Subsequence problem please use PYTHON AND PROVIDE SCREENSHOTS AND Functional

lcs.py

import sys

def lcs(a , b): # # Please write code here commonString = "Dummy String" return (len(commonString), commonString) # pass

# Read input stringA = sys.stdin.readline().strip(' ') stringB = sys.stdin.readline().strip(' ')

lcsSol = lcs(stringA, stringB)

print str(lcsSol[0]) print str(lcsSol[1])

[Active] Exercise: Longest Common Subsequence If you want to use top-down approach (memoization) for this include this line in your code before the call to las(StringA. StringB): sys.setrecursionlimit(2000) n this problem, your job is to find the longest common subsequence oftwo strings. Input Specification: Input consists of two lines, each containing one string. Each string only consists of small case alphabetical letters and can be as long as 1000 characters. Output Specification: Your output should have two lines. First one containing one integer which is the length of the longest common subsequence, and second one containing one such longest common subsequence of the two strings in the input. Note that there might be more that one longest common subsequence. Printing any one of those is acceptable. Partial credit is given to correct value for length but incorrect missing common subsequence in the second line. Sample Input: abcdef xbayzdfe Sample output: bde In this example, there are more common strings of 3, such as: adf and bfe. Printing either of them is acceptable

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!