#C8048. Message Retrieval

    ID: 51987 Type: Default 1000ms 256MiB

Message Retrieval

Message Retrieval

In this problem, you are provided with a messaging system represented as a nested dictionary. Each user may have multiple messages, and each message is identified by its message id. Every message has a subject, a body, and a timestamp (the timestamp will not be used in the output).

You will be given a query string of the form (\mathtt{user_id.message_id}), followed by details of all messages in the system. Your task is to retrieve and print the subject and body of the queried message. If the specified user or message does not exist, output the error message "user not found" or "message not found" respectively on the first line, and an empty string on the second line.

The query format and constraints ensure that the problem not only checks your ability to process nested data but also your skills in handling input and output from standard streams.

inputFormat

Input is read from standard input (stdin) in the following format:

  1. The first line contains the query string in the format (\mathtt{user_id.message_id}).
  2. The second line contains an integer (N) representing the number of messages.
  3. The next (5N) lines describe each message, with each message given in 5 consecutive lines:
    • Line 1: A string representing the user id.
    • Line 2: A string representing the message id.
    • Line 3: A string representing the subject.
    • Line 4: A string representing the body of the message.
    • Line 5: A string representing the timestamp (this field is ignored in processing).

outputFormat

Output to standard output (stdout) should consist of two lines:

  1. The first line should contain the subject of the message (or an error message if the user/message is not found).
  2. The second line should contain the body of the message (or an empty string in case of an error).## sample
user1.101
3
user1
101
Meeting
Project meeting at 10 AM
2023-01-01T10:00:00Z
user1
102
Follow-Up
Please send the report
2023-01-02T12:00:00Z
user2
201
Reminder
Team lunch at 1 PM
2023-01-03T13:00:00Z
Meeting

Project meeting at 10 AM

</p>