Pregunta de entrevista de Arista Networks

It was a coding question regarding a simple algorithm to reformat a given string.