Not able to find error

Here is the question link. link

This solution is correct. solution1
And this is wrong. solution2

Both solution have only a single line difference in way of output.
I am not able to figure out why solution2 is wrong. Could anyone help?
@ssjgz @galencolin @ssrivastava990

Edit: Issue resolved

Bro everything seems to be fine , I m also not able to find where ur solution wrong , @ssjgz can u please check.

2 Likes

I can’t see any mistakes in it; the only thing I can think of is that some testcases have leading 0s in them e.g.

3                                               
8/09/2008
8/9/2008
12/11/2006

in which case your two solutions will give different output (“different” to the online judge, that is).

Edit:

You can probably detect this by adding:

assert(to_string(date) + "/" + to_string(month) + "/" + to_string(year) == s);

before return ans; and re-submitting.

3 Likes

Oh yes , that’s the mistake @arjun8115

@ssjgz I found the error. Actually there was issues in problem test files where there might be chance of leading zeroes. I tested using assert and it gave runtime error.
Thanks:)

2 Likes