Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need python help PROBLEM: A useful computer utility is to report the differences between two files. In this program, you will compare two strings to

Need python help image text in transcribed
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 strin 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 in B and diff ing B to A using the first algorithm. Then using the resulting 2 common strings ap the second algorithm. Print the resulting common string. If it is empty, print "NONE". The quick brown fox did jump over a log The brown rabbit quickly did outjump the fox How many pickled peppers did Peter Piper pick Peter Piper picked a peck of pickled peppers The AllStar Contest is in Wayne Hills NJ Hills are where there are contestants from NJ Fuzzy Wuzzy was a bear Fuzzy Wuzzy had no hair Fuzzy Wuzzy was not fuzzy was he super call frigi listic expi all docious frigid call superman allies expired list SAMPLE OUTPUT 1. Theiox 2. pickledpeppers 3. HillsNJ 4. FuzzyWuzzywas 5

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

Oracle Databases On The Web Learn To Create Web Pages That Interface With Database Engines

Authors: Robert Papaj, Donald Burleson

11th Edition

1576100995, 978-1576100998

More Books

Students also viewed these Databases questions

Question

Explain the pages in white the expert taxes

Answered: 1 week ago

Question

Types of Interpersonal Relationships?

Answered: 1 week ago

Question

Self-Disclosure and Interpersonal Relationships?

Answered: 1 week ago