A dockyard keeps a manifest of n cargo tags, each tag written as a lowercase string. Safety inspectors are checking every tag for one specific hazard letter c; any tag whose characters include c at least once must be flagged for inspection. Given the manifest, report — in the exact order the tags were logged — the 0-indexed positions of every tag that contains the hazard letter c.
Example 1
Input
3 e depot cargo crate
Expected
0 2
Explanation
The hazard letter is 'e'. "depot" contains an 'e' (index 0), "cargo" does not, and "crate" contains an 'e' (index 2). So the flagged positions are 0 and 2.
Example 2
Input
2 z fizz buzz
Expected
0 1
Explanation
The hazard letter is 'z'. Both "fizz" (index 0) and "buzz" (index 1) contain a 'z', so both positions are flagged.
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 →