Astronauts in outer space send compressed transmissions to mission control. Each lowercase letter represents one communication symbol.
A repeated part is written as count[section]. It represents the contents of section repeated exactly count times. A section may contain other repeated sections.
Restore and return the complete astronaut transmission.
AstronautTransmissionRestorer
String restoreTransmission(String compressedTransmission)
compressedTransmission: The compressed transmission sent by the astronauts.Return the complete transmission after expanding every repeated section.
1 and 300.'[' appears immediately after a repetition count.1 ≤ compressedTransmission.length() ≤ 30compressedTransmission contains only lowercase English letters, digits, '[', and ']'.1 and 300.100,000 characters. restoreTransmission(compressedTransmission = "3[uv]2[x]")
Output: "uvuvuvxx"
The section "uv" is repeated three times, followed by 'x' repeated twice.
restoreTransmission(compressedTransmission = "2[m2[np]]")
Output: "mnpnpmnpnp"
The inner section produces "npnp". After adding 'm', the section "mnpnp" is repeated twice.
restoreTransmission(compressedTransmission = "a2[b3[c]]d")
Output: "abcccbcccd"
The inner instruction produces "ccc". Therefore, "bccc" is repeated twice between 'a' and 'd'.
restoreTransmission(compressedTransmission = "signal")
Output: "signal"
The transmission has no repeated sections, so it remains unchanged.