597 broken input
Posted: Fri Mar 15, 2013 1:26 pm
I realise this problem has a red checkmark (I didn't at first since I accessed it via http://uva.onlinejudge.org/external/5/597.html directly), but it seems the input doesn't follow the specification (giving me runtime errors until I figured out the problem).
I confirmed there aren't any empty lines in the input (as expected). However, there seem to be:
1) lines that don't contain any space character (ASCII 32)
2) lines that do have a space but do not have a period (ASCII 46) after the first space
According to the statement: "You may assume that the "last name" is that portion of the file name between the first space character and the period.". That means (IMO) that the existence of a space character and a period somewhere after it is guaranteed. Please look into it.
Also the statement seems to contradict the example illustrated in the included figure; in the text it says the edited version of "John Smith.jpg" is "Smith John.jpg" while the figure shows the addition of a comma (changing "Christina Peter.jpg" to "Peter, Christina.jpg"). The sample output doesn't clear up this issue. For my solution I assumed the simpler version (without a comma).
Finally the statement doesn't mention anything about the sorting order to use; I assumed default lexicographic string sorting (ASCII collation) which is consistent with all the information given but is not uniquely so (particularly I wonder about how to treat spaces [and commas if needed]).
I confirmed there aren't any empty lines in the input (as expected). However, there seem to be:
1) lines that don't contain any space character (ASCII 32)
2) lines that do have a space but do not have a period (ASCII 46) after the first space
According to the statement: "You may assume that the "last name" is that portion of the file name between the first space character and the period.". That means (IMO) that the existence of a space character and a period somewhere after it is guaranteed. Please look into it.
Also the statement seems to contradict the example illustrated in the included figure; in the text it says the edited version of "John Smith.jpg" is "Smith John.jpg" while the figure shows the addition of a comma (changing "Christina Peter.jpg" to "Peter, Christina.jpg"). The sample output doesn't clear up this issue. For my solution I assumed the simpler version (without a comma).
Finally the statement doesn't mention anything about the sorting order to use; I assumed default lexicographic string sorting (ASCII collation) which is consistent with all the information given but is not uniquely so (particularly I wonder about how to treat spaces [and commas if needed]).