Pergunta de entrevista da empresa Arista Networks

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