Solved LeetCode program · 836 of 1,000
#1108 · Defanging an IP Address
Original English source
The source is "1.1.1.1". The parts is an empty list of text.
For every spot from 0 to the last position of source.
The symbol is the slice of source from spot to spot plus 1. If symbol matches ".", Place "[.]" into parts, otherwise Place symbol into parts.
The result is join parts with "". Show result.
Expected stdout
1[.]1[.]1[.]1