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 be have non-alphanumeric characters on both sides.
Note: Leap years are very important for me.
The first line is an integer ~N~, the number of lines in the input. The next ~N~ lines will be the document you need to process.
You are to output all valid dates in the exact format
YYYY-MM-DD inside the document.
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.
1914-06-28 1914-07-28 1914-08-03