#K89407. Log File Report Generator

    ID: 37523 Type: Default 1000ms 256MiB

Log File Report Generator

Log File Report Generator

You are given a log file with several entries. Each entry is a single line in the following format:

YYYY-MM-DD HH:MM:SS <transaction_id> <transaction_type>

The transaction_type is either credit or debit. Your task is to read the entire input from standard input and generate a summary report containing the following information:

  • Total number of transactions.
  • Number of credit transactions.
  • Number of debit transactions.
  • The first transaction id.
  • The last transaction id.
  • The time difference in minutes between the first and the last transaction. The time difference is computed using the formula: \(\text{diff} = \frac{\text{last_time} - \text{first_time}}{60}\).

Print each of these statistics in a new line exactly in the following format:

Total transactions: X
Credit transactions: Y
Debit transactions: Z
First transaction id: id_first
Last transaction id: id_last
Time difference in minutes: M

Ensure that your solution reads input from stdin and writes the result to stdout.

inputFormat

The input is read from standard input and consists of several lines. Each line represents a log entry in the following format:

YYYY-MM-DD HH:MM:SS <transaction_id> <transaction_type>

There is no extra leading or trailing whitespace in the input.

outputFormat

Output the report to standard output exactly as described in the problem statement. The output is six lines, each providing one of the summary statistics with the exact prefixes as given.

## sample
2023-01-01 09:00:00 T123 credit
2023-01-01 09:10:00 T124 debit
2023-01-01 09:30:00 T125 credit
2023-01-01 10:00:00 T126 debit
2023-01-01 10:30:00 T127 credit
Total transactions: 5

Credit transactions: 3 Debit transactions: 2 First transaction id: T123 Last transaction id: T127 Time difference in minutes: 90

</p>