Sobes.tech
Intern — Middle

Replacing dots in IPv4 address with a safe form

livecode

Task condition

Given a valid IPv4 address ip. It is required to return the 'neutralized' form of this address. 'Neutralization' means replacing each dot "." with the string "[.]".

Example 1: Input: ip = "1.1.1.1" Output: "1[.]1[.]1[.]1" Explanation: Each dot is replaced with "[.]", resulting in "1[.]1[.]1[.]1".

Example 2: Input: ip = "255.100.50.0" Output: "255[.]100[.]50[.]0" Explanation: All dots are replaced with "[.]", resulting in "255[.]100[.]50[.]0".