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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started