Security responders publish incident write-ups that must mention the numeric address of a compromised host, but pasting a raw dotted-decimal address into a report risks it being auto-linked by a document viewer, auto-dialed by a network scanner sweeping the text, or flagged outright by a mail filter. The incident team's style guide therefore requires every literal period inside the address to be rewritten as the three-character sequence [.] before it goes into any report. Given a valid dotted-decimal address made of four segments, produce its report-safe form.
A single line containing the address, written as four decimal segments separated by periods, e.g. A.B.C.D.
Print the same four segments in the same order, but with each . separator replaced by the literal three-character sequence [.].
0).Example 1
Input
1.1.1.1
Expected
1[.]1[.]1[.]1
Explanation
The address has three periods separating four '1' segments; each period is replaced by [.], giving 1[.]1[.]1[.]1.
Example 2
Input
255.100.50.0
Expected
255[.]100[.]50[.]0
Explanation
The four segments 255, 100, 50, and 0 have different lengths, but the substitution only touches the three separating periods, giving 255[.]100[.]50[.]0.
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 →