Defanging an IP Address
Easy
Strings
String
Replace every '.' with '[.]'.
Constraints
Valid IPv4
Examples
Example 1:
Input: 1.1.1.1
Output: 1[.]1[.]1[.]1
Example 2:
Input: 255.100.50.0
Output: 255[.]100[.]50[.]0
Tests:
Runtime:
Memory:
Test
Input:
Expected:
Got:
Click Run Code to test against sample cases, or Submit to test against all cases.
▲ Console