You are not logged in. Please login at to post your questions!


GIFTCHEF had wrong input files...

It was mentioned by the GIFTCHEF author @omelyanenko in the comment section on the problem page that the input string will consist of only lowercase english letters... but that was not the case... i submitted my solution assuming the same and i got WA . Out of intuition, when i submitted the same code by stripping the strings with side whitespaces after the contest got ended, i got AC. The accepted solution is . The only difference between the two solution is use of strip() function. What should i expect from Codechef for such blunders?

asked 14 Nov '16, 15:48

ayush_aa's gravatar image

accept rate: 0%

edited 16 Nov '16, 15:56

admin's gravatar image

0★admin ♦♦


Hey, We will have the problem setting panel look into this. They will take the necessary action.

(15 Nov '16, 12:55) admin ♦♦0★


The author himself gave the answer on the contest page.

You must not assume that line endings are unix-style '\n', they may very well be "\r\n". Java and C++-programmers are quite lucky when using formatted input because redundant white space is ignored. In python you have to take care of this yourself.

EDIT: What I'm trying to say is that this is not a blunder on the site of codechef, but it propably will happen again. Nevertheless this question obviously has its merits, because it's easy to forget about the different forms of line endings. But the issue of this thread should be learning about this pitfall, not complaining.


answered 14 Nov '16, 17:02

ceilks's gravatar image

accept rate: 36%

edited 14 Nov '16, 18:02


Yes, the author mentioned that string consists of only lowercase letters. I also got many Wrong Answers while using python. So,I switched to C++ and got it Accepted. Codechef should keep a check on such blunder mistakes, it wastes time of the participants.


answered 14 Nov '16, 16:37

atulac's gravatar image

accept rate: 16%

I submitted around 60 WA's and in all of the subtasks, I got WA in one and AC in rest. It took me so much time, to realize that strings might not be all lowercase as mentioned.

They carried a stepney "\n" at the end. strip() was required.


answered 14 Nov '16, 16:25

aminoacid's gravatar image

accept rate: 0%

@ceilks Sir, there is comment by the author @omelyanenko on the problem page as per which he says, "Strings consist of only lowercase English letters". A novice might get intuition to check for the alternative cases, but author's specific answer makes him think one way. I got many WA when i switched to C++ and knew that same logic worked in C++.


answered 14 Nov '16, 17:19

atulac's gravatar image

accept rate: 16%


I was referring to the answer of the author further down in the thread. You are correct that it's pretty unfortunate for python users, but the authors first answer is also technically correct as the dangling "\r" is not part of the sring but of the representation of the line ending.

(14 Nov '16, 17:42) ceilks7★

It is high time that codechef should disclose the testcases after the contest or bring out something like "hackos" points of hackerrank. It really helps.


answered 14 Nov '16, 16:46

ash_code's gravatar image

accept rate: 15%

I too had this same problem, and just by intuition i did strip() and got everything correct.


answered 14 Nov '16, 16:05

trojan1996's gravatar image

accept rate: 0%

Going by the topic of discussion I thought the problem had wrong test cases. But for fomatting, I don't think it is correct to blame the problem setter(heck even icpc contests have such test files). It is up to the programmer to read what is required and be familiar with nuances of the language, at least i/o.


answered 17 Nov '16, 10:03

noob333's gravatar image

accept rate: 0%

toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:


question asked: 14 Nov '16, 15:48

question was seen: 1,688 times

last updated: 17 Nov '16, 10:03