Pregunta de entrevista de Safaricom

Write an algorithm to solve a simple string problem