We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
The descripency arises from em dash (–) in testcase 2 line 8.
First we should know the difference between
em dash (–) --long hyphen and en dash(-) -- hyphen available in ASCII set
whereas "em dash"(which is 4 bytes wide) is not a part of ASCII set.
"{line:2:1}" takes care of ASCII and Non-ASCII set characters and prints a printable character.
whereas "cut -c 3 " just takes 3rd byte from binay representation of input file and prints it (even if it is non-printable).
In the question we are asked to print ASCII character. So it is better to use cut instead of {line:2:1}.BTW I too did the same mistake :-)
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Cut #1
You are viewing a single comment's thread. Return to all comments →
The descripency arises from em dash (–) in testcase 2 line 8. First we should know the difference between em dash (–) --long hyphen and en dash(-) -- hyphen available in ASCII set whereas "em dash"(which is 4 bytes wide) is not a part of ASCII set.
"{line:2:1}" takes care of ASCII and Non-ASCII set characters and prints a printable character. whereas "cut -c 3 " just takes 3rd byte from binay representation of input file and prints it (even if it is non-printable). In the question we are asked to print ASCII character. So it is better to use cut instead of {line:2:1}.BTW I too did the same mistake :-)