#C2974. Group Transactions by Date

    ID: 46349 Type: Default 1000ms 256MiB

Group Transactions by Date

Group Transactions by Date

In this problem, you are given a series of timestamped transaction records. Each transaction is provided as a string in the format YYYY-MM-DD HH:MM:SS <transaction details>. Your task is to group these transactions by the date component YYYY-MM-DD and then output the groups in ascending order of date. For each date, first print the date itself on a new line, followed by each corresponding transaction (in the same order as they were input), and then print an empty line after each group.

In mathematical terms, if the transaction string is represented as \[ s = \texttt{YYYY-MM-DD HH:MM:SS \

}, \] then the date can be extracted as \(d = YYYY\texttt{-}MM\texttt{-}DD\). The output for each unique date (sorted in ascending order) should be formatted as:

[ \text{date}\newline t_1\newline t_2\newline \cdots\newline t_k\newline \newline ]

This problem tests your ability to process strings, use data structures for grouping, and perform sorting.

inputFormat

The first line of input contains an integer T representing the number of transactions. Each of the following T lines contains a transaction string in the format YYYY-MM-DD HH:MM:SS <transaction details>.

outputFormat

For each unique date (in ascending sort order), output the date on a new line, then each transaction corresponding to that date (in the order of appearance in the input), and finally an empty line after each group.

## sample
5
2022-01-01 09:11:23 Bought office supplies
2022-01-01 10:15:48 Client meeting
2022-01-02 14:22:35 Sent email to client
2022-01-01 11:05:09 Team lunch
2022-01-02 18:30:00 Project submission
2022-01-01

2022-01-01 09:11:23 Bought office supplies 2022-01-01 10:15:48 Client meeting 2022-01-01 11:05:09 Team lunch

2022-01-02 2022-01-02 14:22:35 Sent email to client 2022-01-02 18:30:00 Project submission

</p>