Question: Similarity of Two text files Source file:similar.java Input file:one.in You are hired by Google copyright section. Your assignment is to read two text files (one.in

Similarity of Two text files

Source file:similar.java

Input file:one.in

You are hired by Google copyright section. Your assignment is to read two text files (one.in

and two.in) and return back

the % of similarity between the two files. Each line will have the same number of words, and each word is unique. For

example, if each line contains 10 words that form a sentence, each word considered therefore as 10% similarity

if it

appears in the both lines. If all the words are similar in the two lines you will return 100% similarity, otherwise, if one

word is different among the 10 words, for instance, you should return 90% similarity. The similarity result should be

out

putted to the screen. Words are delimited by whitespaces and/or punctuations marks (period, comma, question,

colon and semicolon). Words are case sensitive. There will be at most 100 words in each file.

NB: be careful when the two files contains many. The

total similarity of all the lines must be computed.

Sample input

Hello friend, we wish you luck in your programming contest

Salam Ahmed, we wish you luck in your programming contest

Sample output

80% similarity

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!