Pregunta de entrevista de Amdocs

code based on arrays