RelayHub runs a private co-working space and keeps a membership roster of registered contact addresses. RelayHub's mail relay only accepts an address as compliant if it starts with exactly one ASCII letter, continues with zero or more ASCII letters, digits, underscores, periods, or hyphens, and then ends with the exact, case-sensitive suffix "@relayhub.io" and nothing else afterward. Given the roster, report the member ids of every compliant address.
Print the ids of every member whose address is compliant, one per line, sorted in strictly increasing numeric order. If no address is compliant, print nothing.
Example 1
Input
4 1 winston@relayhub.io 2 4winston@relayhub.io 3 winston@relaymail.io 4 win.ston_02@relayhub.io
Expected
1 4
Explanation
Id 1's address starts with the letter 'w' and ends with the exact suffix "@relayhub.io", so it is compliant. Id 2 starts with the digit '4' instead of a letter, so it fails. Id 3's domain is "relaymail.io", which does not match the required suffix, so it fails. Id 4's local part "win.ston_02" starts with a letter and uses only allowed characters before the correct domain, so it is compliant. Sorted ascending, the compliant ids are 1 and 4.
Example 2
Input
3 10 a@relayhub.io 5 bob@relayhub.io.uk 7 -bob@relayhub.io
Expected
10
Explanation
Id 10's address is a single letter followed by the exact required domain, so it is compliant. Id 5's domain is "relayhub.io.uk", which has extra characters after the required suffix, so it fails. Id 7 starts with a hyphen instead of a letter, so it fails. Only id 10 remains, so the output is just "10".
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 →