Description

Given a valid IPv4 address, return a defanged version of that IP address. A defanged IP address replaces every period "." with "[.]".

Examples

Input:address = "1.1.1.1"
Output:"1[.]1[.]1[.]1"
Explanation:

Defang the IP.

Input:address = "192.168.0.1"
Output:"192[.]168[.]0[.]1"
Explanation:

Replace each of the 3 periods in the private IP address with '[.]' to defang it, making it safe for display in security contexts.

Input:address = "10.0.0.255"
Output:"10[.]0[.]0[.]255"
Explanation:

Transform the IP address by substituting all periods with '[.]' brackets - this prevents the address from being interpreted as a clickable link.

Constraints

  • Valid IPv4 address

Ready to solve this problem?

Practice solo or challenge other developers in a real-time coding battle!