#K51362. Photo Count by Date
Photo Count by Date
Photo Count by Date
You are given n photo timestamps in the format YYYY-MM-DD hh:mm:ss. Your task is to group the photos by their date (YYYY-MM-DD) and count how many photos were taken on each date.
The output should list each unique date in chronological order along with the corresponding count.
Note: The input is provided via standard input and the result should be printed to standard output. If there are no photos, nothing should be printed.
Example:
Input: 5 2023-09-21 09:12:33 2023-09-21 10:45:22 2023-09-22 14:22:08 2023-09-23 11:55:19 2023-09-21 23:59:59</p>Output: 2023-09-21 3 2023-09-22 1 2023-09-23 1
inputFormat
The first line of input contains an integer n representing the number of photo timestamps.
Each of the following n lines contains a timestamp in the format YYYY-MM-DD hh:mm:ss
.
outputFormat
For each distinct date in chronological order, print a line containing the date followed by the number of photos taken on that date. Separate the date and count by a space.
## sample3
2022-05-01 12:34:56
2022-05-01 13:34:56
2022-05-01 14:34:56
2022-05-01 3
</p>