Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help coding this class program in python PROBLEM: A useful computer utility is to report the differences between two files. In this program, you

Need help coding this class program in python image text in transcribed
PROBLEM: A useful computer utility is to report the differences between two files. In this program, you will compare two strings to find common strings. For this program, a string consists of "words"; words are letters which are separated by a single space. The following algorithm will be used first: Consider each word in turn from left to right in the first string. If that word appears as a word or part of a word in the second string, add the word to the resulting common string and delete the entire first occurrence of the word where it was found in the second string. For example, if "add" is in the first string and "addition" is in the second string, the "add" is deleted from "addition" leaving "ition" in the second string. Words are separated by one space in the common string. Upper and lower case letters are considered different letters Then use this second algorithm: Consider each character in turn in the first resulting common string. If it appears in the second resulting common string, add it to a new resulting common string and delete all characters in the second resulting common string up to and including that character. Ignore blanks. Consider the following 2 strings: A. The quick brown fox did jump over a log B. The brown rabbit quickly did outjump the fox Diff ing A to B gives a result of "The quick brown fox did jump a" Diff ing B to A give a results of "The brown did fox" Using the second algorithm produces: Theiox INPUT: 5 sets of data, where each set consists of 2 strings, each on a separate line. Each string will be at most 100 characters. Blank lines are shown for readability ONLY OUTPUT: For each pair of strings (call them A and B), find the common string by diff ing A to and diff ing B to A using the first algorithm. Then using the resulting 2 common strings apply e second algorithm. Print the resulting common string. If it is empty, print "NONE

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Mining Concepts And Techniques

Authors: Jiawei Han, Micheline Kamber, Jian Pei

3rd Edition

0123814790, 9780123814791

More Books

Students also viewed these Databases questions

Question

Conduct an effective performance feedback session. page 376

Answered: 1 week ago