I have a document full of dates that you need to process. I am really busy, so I need you to write a program for me to find all the dates. I only want valid dates, that is dates that actually exist, in the format YYYY-MM-DD
exactly. Any date that does not fit exactly in YYYY-MM-DD
or does not actually exist must be ignored. A valid date will also have non-alphanumeric characters on both sides.
Note: Leap years are very important for me.
Input Specification
The first line is an integer , the number of lines in the input. The next lines will be the document you need to process.
Output Specification
You are to output all valid dates in the exact format YYYY-MM-DD
inside the document.
Sample Input
4
Archduke Franz Ferdinand was killed on 1914-06-28. On 1914-07-28,
Austria-Hungary declared war on Serbia. Germany attacked Luxemburg on 08-02,
and war was declared on France on 1914-08-03. On 04-08-1914, Britain declared
war.
Sample Output
1914-06-28
1914-07-28
1914-08-03
Comments
My output matches the sample output exactly (for TC 1). Is TC1 different than the sample?
Does the order in which the dates are outputted matter?
Yes.
I had to use this for reference.
;(
The judge reports wrong answer back to me, but the output looks correct. Any tips on how to solve?
Same issue here..
Read the problem statement more carefully, as there's something you're missing.
I see it now, it's the format of output
Could you elaborate on that please?
Carefully re-read the second sentence of the problem statement. There's something you're missing.
Weird, it gives the right output and doesn't crash on my computer. But the judge says it gets out of bounds exception?
Make your own corner cases to run your solution on.
I like how you support the alt-text without having to click through to the comic.