The TransCompilator

Solved LeetCode program · 836 of 1,000

#1108 · Defanging an IP Address

Easy String chunk-17.md

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.

Open in Playground Browse all 1,000 problems

Expected stdout

1[.]1[.]1[.]1