A regional flight-tracking network relays short digital status messages between control towers through a legacy packet relay that can carry at most 15 characters of text in a single burst. Every transmission logged by the network carries a unique numeric id and a text payload; any transmission whose payload is longer than 15 characters cannot fit in one burst and must be flagged so an operator can re-encode it. Given a log of transmissions, report the ids of every over-length transmission.
The first line contains a single integer n — the number of logged transmissions. Each of the next n lines describes one transmission: an integer id, a single space, and then the payload text, which is the remainder of the line. The payload may itself contain interior spaces; it never has a leading or trailing space and never contains a newline.
Print the ids of every transmission whose payload length is strictly greater than 15 characters, in ascending numeric order, space-separated on one line. If no transmission qualifies, print an empty line.
Example 1
Input
3 101 Short message 202 This one is definitely too long 303 Also fine
Expected
202
Explanation
Payload lengths are 13 ('Short message'), 31 ('This one is definitely too long'), and 9 ('Also fine') characters respectively. Only id 202's payload exceeds the 15-character limit, so it alone is printed.
Example 2
Input
3 5 123456789012345 2 1234567890123456 9 abcdefghijklmnop
Expected
2 9
Explanation
Id 5's payload is exactly 15 characters — at the limit but not over it, so it is not flagged. Ids 2 and 9 each have a 16-character payload, exceeding the limit, so both are flagged. Sorted in ascending order by id, the output is '2 9'.
Ready to solve this?
Sign in to open the editor, run your code against the sample tests, and submit against the full test suite.
Sign in to solve →