Pergunta de entrevista da empresa Fidelity Investments

Solve a string splicing problem in Java and Python (had to use both languages)