#K92882. Longest Session Duration

    ID: 38296 Type: Default 1000ms 256MiB

Longest Session Duration

Longest Session Duration

Problem Statement: You are given a single string representing log entries of various users. Each log entry is in the format username|HH:MM (for example, john_doe|08:00) and the entries are separated by commas.

Your task is to compute, for each user, the maximum time interval (in minutes) between two consecutive log entries. If a user has only one log entry, the maximum session duration is \(0\) minutes.

Note: The time format is guaranteed to be valid and is expressed in 24-hour format, where \(HH\) is hours (00 to 23) and \(MM\) is minutes (00 to 59).

inputFormat

The input is read from standard input as a single line string. This string contains multiple log entries separated by commas. Each log entry is formatted as username|HH:MM.

outputFormat

Output to standard output a JSON string. The JSON object should map each username (as a string) to its maximum session duration (an integer, in minutes). The keys in the JSON output must be in lexicographical order.

## sample
john_doe|08:00,jane_doe|09:30,john_doe|10:30,jane_doe|12:45,john_doe|13:00,jane_doe|14:00,john_doe|18:00
{"jane_doe":195,"john_doe":300}