Page 1 of 1
287 Text Comparison: what is it asking for?
Posted: Sun Nov 15, 2009 8:28 am
by howardcheng
This seems to be a standard string distance problem. However, there is no mentioning of the shortest solution. Also, the "change" operation is not so clear to me: should the operation change the smallest number of characters necessary? It does not appear so, because the change operation in the sample output did not have to change the last "y". It is not clear at all what is the unit of change here.
To be absolutely silly, would the single line of output
pos 0 changed <length(text1)> chars from "<text1>" to "<text2>"
be accepted?
287 - Text Comparison
Posted: Sun Nov 15, 2009 8:33 am
by SmartMan
I know that very few people have solved this problem, but I'm giving it a try, and I'm wondering if anyone could tell me if there is an "order of operations" to this problem. There are multiple answers for each test case...
For example, in the sample input:
Code: Select all
This is a joke. This is not life. Don't consider it anyway...
This is not a joke. This is life. Consider it thoroughly...
Gives the output as:
Code: Select all
pos 8 deleted 4 chars "not "
pos 28 inserted 4 chars "not "
pos 34 inserted 6 chars "don't "
pos 46 changed 10 chars from "thoroughly" to "anyway"
But why could this not be: (Note that ALL 4 lines are different)
Code: Select all
pos 7 deleted 4 chars " not"
pos 27 inserted 4 chars " not"
pos 33 inserted 6 chars " don't"
pos 46 changed 9 chars from "thoroughl" to "anywa"
Another example that I have is:
Code: Select all
This is a joke. This is not life. Don't consider it anyway.
This is not a joke. This is life. Consider it thoroughly...
Two possible outputs are:
Code: Select all
pos 8 deleted 4 chars "not "
pos 28 inserted 4 chars "not "
pos 34 inserted 6 chars "don't "
pos 46 changed 12 chars from "thoroughly.." to "anyway"
Code: Select all
pos 8 deleted 4 chars "not "
pos 28 inserted 4 chars "not "
pos 34 inserted 6 chars "don't "
pos 46 changed 10 chars from "thoroughly" to "anyway"
pos 57 deleted 2 chars ".."
Thank you very much! =)